Questions tagged [ansible-playbook]

468 questions
0
votes
1 answer

Ansible playbook "path specified in src not found"

I am runnning into this message when I do this : ansible-playbook -i inventory junos_config_new.yml --check -vvv ansible-playbook 2.9.9 config file = /etc/ansible/ansible.cfg configured module search path = ['/root/.ansible/plugins/modules',…
0
votes
1 answer

How to separate variables using awk and append it to Text file using ansible

What I got as extra variable to ansible playbook is "CHOW_app/timmy_app1/johnn_app3/harper_app4/mona_app5". This is passed as single variable to the playbook. I have to separate it and save it in a text file in this format. REVOKE CHOW app REVOKE…
saffron
  • 143
  • 1
  • 3
  • 12
0
votes
1 answer

How to stop the playbook if the service is already installed using win_service module?

How to stop the playbook if the service is already installed? I am trying: - hosts: windows tasks: - name: check services win_service: name: serviceName register: service_info when: service_info.exists Thank You!
rafp
  • 1
0
votes
1 answer

Ansible: Index value in template file per instance

I am trying to deploy multiple instances of a service on a single host. The service has a config file, and in this config file, I'd like to include the index of the instance that it belongs to. For example: # main.yml - name: Configure each…
user3270760
  • 163
  • 2
  • 2
  • 8
0
votes
1 answer

List tags that exists in a playbook

I have a play that runs one or more roles. I would like to list available tags without parsing all the code. I am indeed experimenting some difficulties in remembering all the tags I put during developing phase.. How can I list all the tags in the…
MUY Belgium
  • 251
  • 3
  • 17
0
votes
1 answer

How to send password with special characters from ansible to Python script?

I am invoking a python script from ansible playbook. While invoking I am passing the credentials to the python script as arguments. The password has some special characters. But in Python script, I am receiving the password without the special…
saffron
  • 143
  • 1
  • 3
  • 12
0
votes
2 answers

Ansible Unable Non Root User Unable to Install using APT

I create a new user using ansible called nginx, nginx is part of the sudo group a, but when I try to do an apt install with this user I get the below error : FAILED! => {"changed": false, "msg": "Failed to lock apt for exclusive operation"} What…
George
  • 113
  • 1
  • 2
  • 7
0
votes
0 answers

Ansible: vmware_guest: VM Deployment

I'm currently trying to figure out how best to approach a situation where a vCenter has one or more Datacenters with the same name but in different Folder Locations. Because of this I'm unable to deploy to the correct Cluster: Currently Ansible…
0
votes
2 answers

Ansible: How to Remove /etc/hosts entries on the remote server using Ansible playbook. I need only the default entries to be present

How to Remove /etc/hosts entries on the remote server using Ansible playbook. I need only the default entries to be present. I need only below entries to be present: 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 …
celcoprab
  • 43
  • 2
  • 3
  • 8
0
votes
1 answer

Using "echo" in a pipe in ansible's shell module

I'm using the shell module: - name: trust gpg key become: true shell: echo -e '5\ny\n' | gpg --homedir /root/.gnupg --command-fd 0 --edit-key 1401d4d21e93 trust But this complains with gpg: cannot open '/dev/tty': No such device or…
lonix
  • 896
  • 10
  • 23
0
votes
2 answers

Installing Multiple Packages on Multiple OS with Ansible

I have a host with 2 servers: one has CentOS and the other Ubuntu installed. I decided to install apache, nginx and php-fpm on both servers and wrote 3 playbooks. ubuntu.yml (/home/ansible/playbook): --- - name: Ubuntu Playbook hosts: ubun …
0
votes
1 answer

How to use ansible to assign multiple existing users to a new group

I created a new group in OS. Now I want to assign 5 or more existing users to that group using ansible. I believe I could do this for single user. --- - name: add user to a group become: 'yes' become_method: sudo hosts: all tasks: -…
Dr. Mian
  • 151
  • 3
  • 11
-1
votes
1 answer

Ansible create files with user permissions in homedir of existing users

I have homedir of few users like that /home/user1 /home/user2 /home/user(n-1) I need ansible to get list of homedir and create file inside every homedir with correct permission. Now i have this playbook --- - hosts: pc070 tasks: - name: Find…
-1
votes
1 answer

Ansible won't create yum repository

I'm trying to get Ansible to set up the EPEL repository on a new AWS instance. It fails if I use the yum_repository module. If I use the yum module and try to install it over the wire it reports as successful but doesn't actually do…
theillien
  • 445
  • 3
  • 13
  • 28
-1
votes
1 answer

Ansible provided user always asking passpharse

I created a jenkins user with Ansible, when I would connect to the machine its always asking passpharse. I didn't set it. The provided key has no passpharse Here is the user creation: - name: Create Jenkins user user: name: jenkins state:…
GergA
  • 149
  • 10