Skip to content

Commit af352d5

Browse files
slagleclaude
andcommitted
Add edpm_playbook_environment variable support to all playbooks
This change adds support for setting environment variables (such as proxy settings) across all playbooks in the edpm-ansible collection through a single, centralized variable. Changes: - Added 'environment: {{ edpm_playbook_environment | default({}) }}' to all 36 playbooks at the play level - Updated docs/source/contributing_playbooks.rst to document the requirement and usage of edpm_playbook_environment - Included example usage showing how to configure proxy settings The edpm_playbook_environment variable accepts a dictionary of environment variable key-value pairs and defaults to an empty dictionary for backward compatibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> Jira: OSPRH-14548 Signed-off-by: James Slagle <[email protected]>
1 parent 2f8404c commit af352d5

37 files changed

+63
-1
lines changed

docs/source/contributing_playbooks.rst

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ roles, a new role should be submitted in the same PR implementing it.
2626
If possible, playbooks should not use tasks directly, only trough a role.
2727

2828
Playbooks must use following basic layout. Exposing variables, `edpm_override_hosts`,
29-
`edpm_max_fail_percentage` and `edpm_any_errors_fatal`.
29+
`edpm_max_fail_percentage`, `edpm_any_errors_fatal`, and `edpm_playbook_environment`.
3030

3131
.. code-block:: YAML
3232
@@ -36,9 +36,34 @@ Playbooks must use following basic layout. Exposing variables, `edpm_override_ho
3636
become: true
3737
any_errors_fatal: "{{ edpm_any_errors_fatal | default(true) }}"
3838
max_fail_percentage: "{{ edpm_max_fail_percentage | default(0) }}"
39+
environment: "{{ edpm_playbook_environment | default({}) }}"
3940
4041
This allows for more granular error handling and playbook application by operators.
4142

43+
Environment Variables
44+
++++++++++++++++++++++
45+
46+
All playbooks must include the `environment` key at the top level (play level) that
47+
references the `edpm_playbook_environment` variable. This variable allows operators
48+
to set environment variables (such as proxy settings) that will be applied to all
49+
tasks within the playbook.
50+
51+
The `edpm_playbook_environment` variable should be a dictionary containing
52+
environment variable key-value pairs. If not defined, it defaults to an empty
53+
dictionary, ensuring backward compatibility.
54+
55+
Example usage:
56+
57+
.. code-block:: YAML
58+
59+
edpm_playbook_environment:
60+
HTTP_PROXY: "http://proxy.example.com:8080"
61+
HTTPS_PROXY: "http://proxy.example.com:8080"
62+
NO_PROXY: "localhost,127.0.0.1"
63+
http_proxy: "http://proxy.example.com:8080"
64+
https_proxy: "http://proxy.example.com:8080"
65+
no_proxy: "localhost,127.0.0.1"
66+
4267
Error handling
4368
++++++++++++++
4469

playbooks/bootstrap.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
hosts: "{{ edpm_override_hosts | default('all', true) }}"
44
strategy: linear
55
gather_facts: false
6+
environment: "{{ edpm_playbook_environment | default({}) }}"
67
tasks:
78
- name: Wait for connection
89
ansible.builtin.wait_for_connection:
@@ -14,6 +15,7 @@
1415
gather_facts: "{{ gather_facts | default(false) }}"
1516
any_errors_fatal: "{{ edpm_any_errors_fatal | default(true) }}"
1617
max_fail_percentage: "{{ edpm_max_fail_percentage | default(0) }}"
18+
environment: "{{ edpm_playbook_environment | default({}) }}"
1719
tasks:
1820
- name: Gather ansible_local facts
1921
ansible.builtin.setup:

playbooks/ceph_client.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
gather_facts: "{{ gather_facts | default(false) }}"
77
any_errors_fatal: "{{ edpm_any_errors_fatal | default(true) }}"
88
max_fail_percentage: "{{ edpm_max_fail_percentage | default(0) }}"
9+
environment: "{{ edpm_playbook_environment | default({}) }}"
910
tasks:
1011
# Copy files from localhost, path specified in `edpm_ceph_client_files_source`
1112
- name: Configure EDPM as client of Ceph

playbooks/ceph_hci_pre.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
gather_facts: "{{ gather_facts | default(false) }}"
77
any_errors_fatal: "{{ edpm_any_errors_fatal | default(true) }}"
88
max_fail_percentage: "{{ edpm_max_fail_percentage | default(0) }}"
9+
environment: "{{ edpm_playbook_environment | default({}) }}"
910
tasks:
1011
# Sets up firewall for ceph
1112
- name: Prepare EDPM to Host Ceph

playbooks/configure_network.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
gather_facts: "{{ gather_facts | default(false) }}"
77
any_errors_fatal: "{{ edpm_any_errors_fatal | default(true) }}"
88
max_fail_percentage: "{{ edpm_max_fail_percentage | default(0) }}"
9+
environment: "{{ edpm_playbook_environment | default({}) }}"
910
tasks:
1011
- name: Gather ansible_local facts
1112
ansible.builtin.setup:

playbooks/configure_os.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
gather_facts: "{{ gather_facts | default(false) }}"
77
any_errors_fatal: "{{ edpm_any_errors_fatal | default(true) }}"
88
max_fail_percentage: "{{ edpm_max_fail_percentage | default(0) }}"
9+
environment: "{{ edpm_playbook_environment | default({}) }}"
910
tasks:
1011
- name: Gather ansible_local facts
1112
ansible.builtin.setup:

playbooks/configure_ovs_dpdk.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
hosts: "{{ edpm_override_hosts | default('all', true) }}"
55
strategy: linear
66
gather_facts: "{{ gather_facts | default(false) }}"
7+
environment: "{{ edpm_playbook_environment | default({}) }}"
78
tasks:
89
- name: Gather ansible_local facts
910
ansible.builtin.setup:

playbooks/download_cache.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
gather_facts: "{{ gather_facts | default(false) }}"
77
any_errors_fatal: "{{ edpm_any_errors_fatal | default(true) }}"
88
max_fail_percentage: "{{ edpm_max_fail_percentage | default(0) }}"
9+
environment: "{{ edpm_playbook_environment | default({}) }}"
910
tasks:
1011
- name: Gather ansible_local facts
1112
ansible.builtin.setup:

playbooks/fips_status.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
gather_facts: "{{ gather_facts | default(false) }}"
66
any_errors_fatal: "{{ edpm_any_errors_fatal | default(true) }}"
77
max_fail_percentage: "{{ edpm_max_fail_percentage | default(0) }}"
8+
environment: "{{ edpm_playbook_environment | default({}) }}"
89
tasks:
910
- name: FIPS status
1011
ansible.builtin.include_role:

playbooks/frr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
gather_facts: "{{ gather_facts | default(false) }}"
77
any_errors_fatal: "{{ edpm_any_errors_fatal | default(true) }}"
88
max_fail_percentage: "{{ edpm_max_fail_percentage | default(0) }}"
9+
environment: "{{ edpm_playbook_environment | default({}) }}"
910
tasks:
1011
- name: EDPM FRR
1112
ansible.builtin.import_role:

0 commit comments

Comments
 (0)