Skip to content

Commit 03adeb7

Browse files
committed
feat: use wait_for_connection
Previously we have needed to use `command` to perform pings from the control host, however, this is no longer required as we can use `wait_for_connection` against a full inventory.
1 parent 0447c6c commit 03adeb7

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

ansible/deploy-openstack-config.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,10 @@
1717
- vxlan_vni != None
1818
fail_msg: "Please provide a VXLAN VNI. A unique value from 1 to 100,000."
1919

20-
- name: Ensure Ansible host is reachable
21-
ansible.builtin.wait_for_connection:
22-
2320
- name: Gather facts about the host
2421
ansible.builtin.setup:
25-
26-
- name: Ensure hosts are reachable
27-
ansible.builtin.command:
28-
cmd: "ping -c 1 -w 2 {{ item.value }}"
29-
loop: "{{ (lookup('file', 'files/admin-oc-networks.yml') | from_yaml).admin_oc_ips | dict2items }}"
30-
changed_when: false
31-
register: ping_results
32-
retries: 3
33-
until: ping_results is succeeded
22+
gather_subset:
23+
- user_dir
3424

3525
- name: Ensure git is present
3626
ansible.builtin.package:

ansible/fix-homedir-ownership.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
---
22
- name: Fix Home Directory Ownership
33
hosts: all
4-
gather_facts: true
4+
gather_facts: false
55
vars:
66
# At the time of running this playbook the home directory is not owned by the user.
77
# Therefore, we will not be permitted to store the Ansible temporary directory in the home folder.
88
# This must be relocated to some where that can be written to by the remote user.
99
ansible_remote_tmp: "/tmp/ansible"
1010
tasks:
11-
- name: Ensure homedir is owned by cloud-user # noqa: no-changed-when
11+
- name: Ensure hosts are reachable
12+
ansible.builtin.wait_for_connection:
13+
14+
- name: Gather the home directory of the user
15+
ansible.builtin.setup:
16+
gather_subset:
17+
- user_dir
18+
19+
- name: Ensure homedir is owned by {{ ansible_user }}
1220
ansible.builtin.file:
1321
dest: "{{ ansible_env.HOME }}"
1422
state: directory

0 commit comments

Comments
 (0)