From 6e2bb04faee5340ad4865498e43e1429c3d0203b Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Wed, 27 Mar 2019 16:42:35 +0000 Subject: [PATCH] Add playbook tags Allows for easily running specific playbooks. Change-Id: Ia859238042eb286b61758acd8f99361c10dc0a05 --- ansible/cleanup_state.yml | 2 ++ ansible/deploy.yml | 2 ++ ansible/flavor_registration.yml | 2 ++ ansible/host_setup.yml | 6 ++++++ ansible/node_bmc.yml | 4 ++++ ansible/node_enrolment.yml | 4 ++++ ansible/node_instantiation.yml | 4 ++++ ansible/node_networking.yml | 5 +++++ ansible/resource_wait.yml | 2 ++ ansible/schedule.yml | 4 ++++ ansible/teardown.yml | 2 ++ 11 files changed, 37 insertions(+) diff --git a/ansible/cleanup_state.yml b/ansible/cleanup_state.yml index 7eaa2ce..f865caf 100644 --- a/ansible/cleanup_state.yml +++ b/ansible/cleanup_state.yml @@ -1,5 +1,7 @@ --- - hosts: localhost + tags: + - cleanup-state tasks: - name: Load state from file include_vars: diff --git a/ansible/deploy.yml b/ansible/deploy.yml index acd9bf2..965e655 100644 --- a/ansible/deploy.yml +++ b/ansible/deploy.yml @@ -1,5 +1,7 @@ --- - hosts: all + tags: + - always tasks: - name: Set command for deployment set_fact: diff --git a/ansible/flavor_registration.yml b/ansible/flavor_registration.yml index 20ab397..84613d3 100644 --- a/ansible/flavor_registration.yml +++ b/ansible/flavor_registration.yml @@ -1,5 +1,7 @@ --- - hosts: localhost + tags: + - flavor-registration tasks: - name: Configure Nova flavors include_role: diff --git a/ansible/host_setup.yml b/ansible/host_setup.yml index e677aa8..4a54fc6 100644 --- a/ansible/host_setup.yml +++ b/ansible/host_setup.yml @@ -1,5 +1,7 @@ --- - hosts: localhost + tags: + - host-setup tasks: - name: Load state from file include_vars: @@ -7,6 +9,8 @@ name: tenks_state - hosts: hypervisors + tags: + - host-setup vars: physnet_indices: >- {{ hostvars.localhost.tenks_state[inventory_hostname].physnet_indices }} @@ -14,6 +18,8 @@ - include_tasks: hypervisor_setup.yml - hosts: libvirt + tags: + - host-setup tasks: - block: - name: Configure host for Libvirt diff --git a/ansible/node_bmc.yml b/ansible/node_bmc.yml index 044ebe5..0ce97bf 100644 --- a/ansible/node_bmc.yml +++ b/ansible/node_bmc.yml @@ -1,5 +1,7 @@ --- - hosts: localhost + tags: + - node-bmc tasks: - name: Load state from file include_vars: @@ -8,6 +10,8 @@ - name: Perform Virtual BMC configuration hosts: libvirt + tags: + - node-bmc vars: # List of ironic drivers that require virtualbmc. vbmc_drivers: >- diff --git a/ansible/node_enrolment.yml b/ansible/node_enrolment.yml index 25fa641..b95300c 100644 --- a/ansible/node_enrolment.yml +++ b/ansible/node_enrolment.yml @@ -1,4 +1,8 @@ +--- - hosts: localhost + tags: + - node-enrolment + - node-enrollment tasks: - name: Load state from file include_vars: diff --git a/ansible/node_instantiation.yml b/ansible/node_instantiation.yml index 3cefffb..08c68f9 100644 --- a/ansible/node_instantiation.yml +++ b/ansible/node_instantiation.yml @@ -1,5 +1,7 @@ --- - hosts: localhost + tags: + - node-instantiation tasks: - name: Load state from file include_vars: @@ -7,6 +9,8 @@ name: tenks_state - hosts: libvirt + tags: + - node-instantiation vars: nodes: >- {{ hostvars.localhost.tenks_state[inventory_hostname].nodes diff --git a/ansible/node_networking.yml b/ansible/node_networking.yml index 4a1d84e..c3b237d 100644 --- a/ansible/node_networking.yml +++ b/ansible/node_networking.yml @@ -1,4 +1,7 @@ +--- - hosts: localhost + tags: + - node-networking tasks: - name: Load state from file include_vars: @@ -6,6 +9,8 @@ name: tenks_state - hosts: hypervisors + tags: + - node-networking vars: nodes: >- {{ hostvars.localhost.tenks_state[inventory_hostname].nodes diff --git a/ansible/resource_wait.yml b/ansible/resource_wait.yml index af2527b..96d2dc1 100644 --- a/ansible/resource_wait.yml +++ b/ansible/resource_wait.yml @@ -1,5 +1,7 @@ --- - hosts: localhost + tags: + - resource-wait tasks: - name: Set default value for expected resources set_fact: diff --git a/ansible/schedule.yml b/ansible/schedule.yml index 2ec92b3..de6977e 100644 --- a/ansible/schedule.yml +++ b/ansible/schedule.yml @@ -1,9 +1,13 @@ --- # Ensure we have facts about all hypervisors before scheduling begins. - hosts: hypervisors + tags: + - schedule gather_facts: true - hosts: localhost + tags: + - schedule tasks: - name: Check that all specified node types exist fail: diff --git a/ansible/teardown.yml b/ansible/teardown.yml index a1b6470..bd314fb 100644 --- a/ansible/teardown.yml +++ b/ansible/teardown.yml @@ -1,5 +1,7 @@ --- - hosts: all + tags: + - always tasks: - name: Set command for teardown set_fact: