Update role to stop the pip installations
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
---
|
||||
# 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
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- linode_api_token is defined
|
||||
- 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
|
||||
|
||||
- name: Ensure output directory exists
|
||||
@@ -16,20 +23,6 @@
|
||||
mode: '0755'
|
||||
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
|
||||
ansible.builtin.copy:
|
||||
src: linode_inventory.py
|
||||
|
Reference in New Issue
Block a user