Update role to stop the pip installations

This commit is contained in:
2025-08-07 13:12:49 -05:00
parent bc69e83674
commit 87d618f553

View File

@@ -1,12 +1,19 @@
--- ---
# Main tasks for linode_inventory role # Main tasks for linode_inventory role
- name: Set API token (AWX credential injection takes precedence)
ansible.builtin.set_fact:
linode_api_token: "{{ linode_api_token | default(lookup('env', 'LINODE_API_TOKEN')) | default('') }}"
- name: Validate required variables - name: Validate required variables
ansible.builtin.assert: ansible.builtin.assert:
that: that:
- linode_api_token is defined - linode_api_token is defined
- linode_api_token | length > 0 - linode_api_token | length > 0
fail_msg: "linode_api_token must be defined and not empty" fail_msg: |
Linode API token not found.
For AWX: Attach a Linode API Token credential to your job template
For local: Set LINODE_API_TOKEN environment variable or pass linode_api_token variable
quiet: true quiet: true
- name: Ensure output directory exists - name: Ensure output directory exists
@@ -16,20 +23,6 @@
mode: '0755' mode: '0755'
delegate_to: localhost delegate_to: localhost
- name: Check if Python requests module is available
ansible.builtin.command: python3 -c "import requests"
register: python_requests_check
failed_when: false
changed_when: false
delegate_to: localhost
- name: Install Python requests if not available
ansible.builtin.pip:
name: requests
state: present
when: python_requests_check.rc != 0
delegate_to: localhost
- name: Copy Linode inventory script - name: Copy Linode inventory script
ansible.builtin.copy: ansible.builtin.copy:
src: linode_inventory.py src: linode_inventory.py