Marcos Entenza
2020-02-16 3ec1481938fc048b65e968a9598997b8a01604c9
commit | author | age
8d2e2d 1 ---
ME 2 - name: Step 00xxxxx software
3   hosts: localhost
4   gather_facts: False
5   become: false
6   tasks:
7     - debug:
8         msg: "Software tasks Started"
9
3ec148 10 - name: Ensure NFS Server is installed, SAP Software Device Mounted and Ansible Installed
8d2e2d 11   hosts: bastion
ME 12   become: True
13   gather_facts: True
14   tasks:
3ec148 15
ME 16     - name: Ensure NFS directory exists
17       file:
18         path: "/nfs"
19         state: directory
20
21     - name: Mount up device by UUID
22       mount:
23         path: /nfs
24         src: /dev/vdb
25         fstype: xfs
26         state: present
27
28     - name: 'Ensure required packages are installed'
29       package:
30         name: '{{ item }}'
31         state: installed
32       with_items:
33       - nfs-utils
34       - firewalld
35
36     - name: 'Ensure firewalld is running'
37       service:
38         name: firewalld
39         state: started
40         enabled: yes
41
42     - name: 'Open Firewall for NFS use'
43       firewalld:
44         port: "{{ item }}"
45         permanent: yes
46         state: enabled
47         immediate: yes
48       with_items:
49       - 111/tcp
50       - 111/udp
51       - 2049/tcp
52       - 2049/udp
53
54     - name: "Ensure export file contains the directory to be shared"
55       lineinfile:
56         path: /etc/exports
57         state: present
58         regexp: "^/nfs"
59         line: "/nfs *(insecure,rw,root_squash,no_wdelay,sync)"
60
61     - name: 'Ensure nfs-server is restarted and running'
62       service:
63         name: nfs-server
64         state: restarted
65         enabled: yes
66
8d2e2d 67     - name: Ensure Ansible is installed
ME 68       yum:
69         name: ansible
70         state: latest
71
72 - name: Deploy Ansible Tower
73   hosts: towers
74   gather_facts: False
75   become: yes
76   tasks:
77     # This is a bit hacky but we are facing some issues with Ansible, RHEL8 and python for some
78     # modules and this workaround solved this particular issue
79     - name: Ensure Python3 package is installed and alternatives for python updated
80       shell: >
81         yum install -y python3 && alternatives --set python /usr/bin/python3
82
83     - name: Install Anisble Tower
84       include_role:
85         name: infra-ansible/roles/ansible/tower/config-ansible-tower
86
87 - name: Software flight-check
88   hosts: localhost
89   connection: local
90   gather_facts: false
91   become: false
92   tags:
93     - post_flight_check
94   tasks:
95     - debug:
96         msg: "Software checks completed successfully"
97