Stack Overflow Forums » Ansible
1 FOLLOWERS
most recent 30 from stackoverflow.com
Stack Overflow Forums » Ansible
5h ago
I am new to ansible / vagrant . I am looking to setup a Ansible lab on my Windows 11 home edition using vagrant , virtualbox . plz help
I went through few videos it was showing on linux host and when I tried the same on windows it throws me error as
ansible-lab-node-1 - Downloading: https://vagrantcloud.com/fedora/boxes/38-cloud-base/versions/38.20230413/providers/virtualbox.box Download redirected to host: download.fedoraproject.org ansible-lab-node-1: ansible-lab-node-1: Calculating and comparing box checksum... ==> ansible-lab-node-1: Successfully added box 'fedora/38-cloud-base' (v38.20 ..read more
Stack Overflow Forums » Ansible
5h ago
I am making my own small cluster server and configuring everything through Ansible but I am a bit stuck on checking whether or not a variable has been inserted into /boot/firmware/cmdline.txt or not.
Assume group_vars/all.yml contains the following definition:
cgroup_vars:
- 'cgroup_enable=cpuset'
- 'cgroup_memory=1'
- 'cgroup_enable=memory'
I load the content into a variable with the following tasks in my playbook:
- name: Read cmdline.txt for use below.
shell: 'cat /boot/firmware/cmdline.txt'
register: cmdline
- name: Get individual environmental variables from cmdline ..read more
Stack Overflow Forums » Ansible
14h ago
I want to use a variable in the path of the playbook
ansible.builtin.import_playbook: "{{ home_directory_of_user }}/.ansible/.......
I do have:
- hosts: localhost
gather_facts: false
vars_files:
- "{{ var_file }}"
tasks:
- name: var_file
set_fact:
ansible_collections_directory: "{{ ansible_collections_directory }}"
- name: Import the k3s playbook with flannel
ansible.builtin.import_playbook: "{{ hostvars['localhost']['ansible_collections_directory'] }}/techno_tim/k3s_ansible/site.yml"
vars:
ansible_collections_directory: "{{ hostvars['localhost']['an ..read more
Stack Overflow Forums » Ansible
18h ago
Considering the following test playbook:
---
- name: Playbook
hosts: localhost
become: false
gather_facts: false
vars:
first:
alpha: 1
gamma: 3
second:
beta: 2
tasks:
- name: Import facts
ansible.builtin.import_role:
name: helm
tasks_from: facts
- name: Debug
ansible.builtin.debug:
msg: "{{ lookup('ansible.builtin.dict', first | combine(second)) }}"
Which produces the expected key, value result:
ok: [localhost] =>
msg:
- key: alpha
value: 1
- key: gamma
value: 3
- key: beta
value: 2
Whil ..read more
Stack Overflow Forums » Ansible
18h ago
have 3 GCP folders,
folder_a
folder_b
folder_c
need to write a dynamic inventory file to get the VMs in the list of folders.
I have 10 projects in each folder but I want to filter the project with the project label "severity=critical" . I need to only get the list of VMs from the projects having that label.
I tried ,
--- plugin: google.cloud.google_compute
but there is no option to filter the project labels. only VM level labels can be filtered ..read more
Stack Overflow Forums » Ansible
18h ago
I get below error for a file module in my ansible playbook. I am trying to create a file in remote server using file module, where i got this error when i run for a long set of inventory, whereas when i tried to reproduce it for only troublesome host it is succeeding. I am unable to reproduce the issue. I did not store file module outcome in register variable in my playbook.
Now, I just want to know what would be the register variable content if "Timeout waiting for privilege escalation prompt" occur, so that i can add conditions to capture this into a report in my playbook.
ACTUAL OUTCOME:
n ..read more
Stack Overflow Forums » Ansible
21h ago
I have added the below line in ansible.cfg
vault_password_file = /var/tmp/password
I wanted to secure this file /var/tmp/password in such a way that only user ID (say abc12 user with group pcuser) has access. Others should not be able to read it. (not even root)
Below is what I tried:
Created the file with user abc12. Changed permission using root by below command
chown abc12:pcuser /var/tmp/password
chmod 600 /var/tmp/password
After this, permission is changed. But still root is able to read it. I don't want root to read this file. Kindly advise ..read more
Stack Overflow Forums » Ansible
1d ago
I have this playbook script to execute some basic task on the switch and firewall.
Parent :
- hosts: localhost
become: no
gather_facts: no
vars_prompt:
- name: ansible_user
prompt: "Enter Username"
private: no
- name: ansible_password
prompt: "Enter Password"
private: yes
- name: Execute Script on Switch
import_playbook: test_dummy_switch.yml
- name: Execute Script on Firewall
import_playbook: test_dummy_fw.yml
Child 1 / Switch : test_dummy_coreit.yml
- hosts: Switch
become: no
gather_facts: no
vars_prompt:
- name: ansible_user ..read more
Stack Overflow Forums » Ansible
1d ago
I'm attempting to pass a list of dictionaries to an Ansible role that expects a variable defined per the below.
var1:
- path: /A/1
state: directory
- path: /B/1
state: directory
Let's say I have a list of root directories:
root_dirs:
- A
- B
And a list of common sub directories:
sub_dirs:
- 1
- 2
- 3
Is there an easy way to construct the above var1 list that doesn't involve typing out all of the path combinations?
I know how to combine the paths (root_dirs | product(sub_dirs) | map("join", "\")), but I am not sure how to turn that into var1.
I am trying to do this i ..read more
Stack Overflow Forums » Ansible
1d ago
For Some Reason when this task is reached and is_nginx is true it skips it, i've also changed it to a block and put import_tasks inside the block instead of include and it has all the items but just skips them all
It's boggling my mind as i have similar includes with when statements else where and it works fine
There are no other errors so i'm ruling out the vars: block having any issues
Does anyone have any idea what is causing this issue?
Ansible Version
ansible [core 2.14.11]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr ..read more