Questions tagged [ansible-2.x]

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications— automate in a language that approaches plain English, using SSH, with no agents to install on remote systems

Ansible 2.x is a new backwards-incompatible version that involved a rewrite of the core, and a new API.

Ansible 2.x features new commands like ansible-vault, allowing you to store encrypted information in playbooks and have them decrypted on the fly. It also includes new concepts like Task Blocks, Dynamic Includes, Execution Strategy Plugins, and a suite of new "batteries included" modules. Most importantly, new releases are named after Led Zepplin songs, rather than Van Halen.

https://raw.githubusercontent.com/ansible/ansible/stable-2.0/CHANGELOG.md

Related Tags

1908 questions
0
votes
1 answer

Access element of list as dict

I'm trying to access the elements of a list, but whenever I try to access it's elements they are treated as text (see the debug output). How can I loop over the elements of content[0]? ansible version: 2.5.1 playbook.yml: - hosts: localhost …
0
votes
1 answer

Ansible : delete an item from a dictionary

I have a dictionary with key values and few values are lists. I want to delete an item from the list inside the dictionary. Dict looks like below which has nested items. Dict Looks Like: title: Some Title metadata : manifest-version: 1.0 key:…
Arjun Kanti
  • 101
  • 2
  • 4
  • 12
0
votes
1 answer

Where would Ansible run a command if no directory is specified?

I am encountering a problem where I am running the same tasks on 2 remote nodes and the directories that those commands are executed at are different. If I run pwd through Ansible on each remote host before this command, they return different…
moonmoon
  • 110
  • 10
0
votes
1 answer

Ansible Jinja2 template for loop

I have two linux servers: - server1: ip: 10.241.55.6, hostname: server1 - server2: ip: 10.242.55.7, hostname: server2 I have created an ansible inventory file named servers with the content bellow: [IC] 10.241.55.6 10.241.55.7 Now I have created…
Bogdan Stoica
  • 4,349
  • 2
  • 23
  • 38
0
votes
1 answer

Ansible to create users and assign them to a particular group based on vars

Gurus, I'm learning ansible and trying to understand how the variables can be used, i have come across writing below playbook but i'm not understanding How to assign a particular group to particular users based on the Variables i have defined in the…
user2023
  • 452
  • 5
  • 22
0
votes
1 answer

Ansible how to run powershell script

Im using ansible 2.9.2 and i want to run a script that creates user on my windows machine, The script works if i run in my powershell localy like this : powershell.exe -ExecutionPolicy Bypass -File create_user.ps1 -pass "{{ pass }}" -user "{{ user…
Batchen Regev
  • 685
  • 1
  • 7
  • 28
0
votes
1 answer

How to add variable in between strings in ansible -playbook

Im using ansible 2.9.2, i have a playbook that copys a file to a virtual machine in a vcenter, i need to put a var in a string : somevar = home dest: 'c:\Users\"{{ somevar }}"\Desktop\test' This way didnt work, the error i get : msg = 'A…
Batchen Regev
  • 685
  • 1
  • 7
  • 28
0
votes
3 answers

How to change vmware network adapter with ansible

Im using ansible 2.9.2, i need to replace network adapter on vmware specific vm. In my vcenter vm settings i see : Networks: Vlan_12 My playbook doesnt see that network name. tasks: - name: Changing network adapter …
Batchen Regev
  • 685
  • 1
  • 7
  • 28
0
votes
3 answers

Unable to get Ansible playbook to run on initial run

I am running into an issue with Ansible 2.9 where I get the following error after the ec2 instance is created and before it tries to run apt update on that instance the first time around using the playbook I created: [WARNING]: Could not match…
Chris
  • 61
  • 5
0
votes
0 answers

Ansible : How to install roles from requirements with parametrized branch variable

i want to install some roles from my requirements.yaml file , which looks like this : requirements.yaml: - src: git@gitlab.company.com:mygroup/ansible-base.git scm: git version: "mybranch" #MY BRANCH AS PARAMETER to install , i'm used to run…
firasKoubaa
  • 6,439
  • 25
  • 79
  • 148
0
votes
1 answer

Ansible json key output

Im using ansible 2.9.2 and i have this playbook : register: output - debug: msg={{ output.instance }} which gives this output: TASK [debug]…
Batchen Regev
  • 685
  • 1
  • 7
  • 28
0
votes
1 answer

How to fix the error 'module' object has no attribute 'UnexpectedResponse' in Ansible playbook

Here is the playbook for your reference: --- - name: Closing notes hosts: XXXX gather_facts: yes tasks: - name: Modify a change request snow_record: state: present table: change_request username: admin password:…
0
votes
1 answer

How to run a single role tasks(multiple tasks) on multiple hosts..?

I have a main.YAML file inside a single role/test/tasks. i.e /roles/test/tasks/main.yaml. In my main.yaml I have defined multiple tasks and want to run those multiple tasks on multiple hosts. say - first two tasks should run on hostA, next two…
Deepesh Goel
  • 283
  • 1
  • 3
  • 6
0
votes
1 answer

Ansible playbook is not skipping the task when variable defined is not parsed

I am using the ansible lineinfile module to replace few lines in file. The two variables "apache_status" & " collector_status" are passed as extra vars when running the playbook. However, when i dont pass collector_status , the second task is…
learning fun
  • 519
  • 1
  • 5
  • 12
0
votes
1 answer

ansible shell command syntax error in using colon

Team, I have a task finding mounts and counting them if they are 0 or greater than 64 in count. I tried double quoting colon and also single quote whole command but no luck. Can anyone hint how to resolve this? - name: "Mounts count on GPU…
AhmFM
  • 1,552
  • 3
  • 23
  • 53