Advertisement
sandervanvugt

et.yaml

May 18th, 2022
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. [ansible@control lesson8]$ cat et.yaml
  2. ---
  3. # replace copy content with bliock in file
  4. - name: injecting ansible1 facts
  5. hosts: all
  6. vars:
  7. remote_dir: /etc/ansible/facts.d
  8. facts_file: ansible1.fact
  9. tasks:
  10. - name: create fact dir
  11. file:
  12. state: directory
  13. recurse: yes
  14. path: "{{ remote_dir }}"
  15. - name: install facts ansible1
  16. copy:
  17. content: 'type=production'
  18. dest: "{{ remote_dir }}/localfact.fact"
  19. when: ansible_hostname == "ansible1"
  20. - name: install on ansible2
  21. copy:
  22. content: 'type=testing'
  23. dest: "{{ remote_dir }}/localfact.fact"
  24. when: ansible_hostname == "ansible2"
  25.  
  26. - name: install vsftpd conditional
  27. hosts: all
  28. tasks:
  29. - name: install vsftpd
  30. yum:
  31. name: vsftpd
  32. state: present
  33. when: ansible_facts.ansible_local.ansible1.servertype.type == "production"
  34. - name: enable vsftpd
  35. service:
  36. name: vsftpd
  37. enabled: yes
  38. - name: create readme file
  39. copy:
  40. content: "Welcome to this FTP server"
  41. dest: /var/ftp/pub/README
  42. force: no
  43. mode: 0444
  44. ...
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement