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

How to dynamically generate variables for host group in ansible only once

I have static hosts, in my all.yml group_vars, I have some variables that I want to generate from an REST API's response. I can use uri module in task and register the variables for the play, but I think it calls the api for every host. But I want…
Riddhesh
  • 571
  • 5
  • 18
0
votes
1 answer

How i can variable dict key in variable file in ansible

in host file i have host vars: XX.XX.XXX.XXX: role: value1 then in group vars there is: my_dict: value1: [1,2,3] value2: [3,4,5] in playbook i'm trying to reach the result_list: - name: test hosts: win gather_facts: no tasks: - name:…
SimonZen
  • 131
  • 1
  • 11
0
votes
1 answer

Ansible Playbook save telnet show run command to a file syntax error

I am facing problems with the syntax of my Ansible playbook. I am trying to use show commands using ansible's telnet module, following this resource: https://docs.ansible.com/ansible/latest/modules/telnet_module.html#telnet-module It works fine but…
Zahra
  • 3
  • 1
  • 3
0
votes
1 answer

Customize dynamic inventory

Groups configured in Ansible inventory: Group_A has 30 servers Group_B has 40 Servers Group_C has 15 Servers I want to take 10 servers from each group and make a new group without editing the inventory manually. These 10 servers is a variable that…
som
  • 11
  • 3
0
votes
0 answers

How to parse logs to differentiate between different failures in Ansible?

In Ansible you get an output toward the end (the recap) that displays a failed=x number. For me, this typically ranges between 0 and 1. The only problem is that there is a whole host of different kinds of failures from timing out to unable to…
Zetera
  • 13
  • 4
0
votes
1 answer

Create dictionary on condition

I have the following dictionary : mariadb_custom_cnf: { mysqld: { log-bin: '', server_id: '{{ groups[host_group_name].index(inventory_hostname) | int + 1 }}', replicate-do-db: 'replicate' }} What I want to do is for it to be created when a…
Juntao
  • 11
  • 5
0
votes
1 answer

Is it possible to have Ansible check a configuration on a device and run certain tasks if conditions are met?

I am trying to automate changes across our infrastructure. In this case we have 3 variations of switches that do or do not need to be configured: The first variation are switches that contain legacy configs leading to outdated RADIUS servers. The…
Zetera
  • 13
  • 4
0
votes
1 answer

Ansible : how to run multiple steps shell command with special chars

Under my Playbook , i want to run a shell command which is the following : for STACK in stackone stacktwo;do docker stack ps --format "table {{.ID}}\t{{.Name}}\t{{.CurrentState}}\t{{.Error}}\t{{.Node}}" $STACK | (read -r; printf "%s\n" "$REPLY";…
firasKoubaa
  • 6,439
  • 25
  • 79
  • 148
0
votes
1 answer

how to loop ansible json_query

is there any way to simplify the below json_query? here you can see that i am trying to extract three values using three setup of queries. Since i have three items in the list the value will be generated three times corresponding to the item list.…
mikeraj2019
  • 39
  • 2
  • 10
0
votes
1 answer

How to grab specific group from ansible inventory and use it in playbook?

I need to grab specific sub group from my inventory file and use it in ansible playbook correctly. all: children: development: children: ntp_servers: hosts: ntp01: ntp02: services: …
0
votes
1 answer

How to get inside Solaris zone and execute commands there by using Ansible playbook?

I have simple play book for Solaris - name: root access test hosts: solaris serial: "10" tasks: - name: Make nfs mount on a remote server become: yes delegate_facts: True shell: mount -F nfs -o vers=3,soft,timeo=10 …
0
votes
2 answers

Need Syntax to add Ansible meta module to existing Playbook

I wish to search for a string ("AC245") in all files with extension *.db under /home/examples directory. Below is what i tried. --- - name: "Find the details here " hosts: localhost any_errors_fatal: true serial: 1 tasks: - name: Ansible…
Ashar
  • 2,942
  • 10
  • 58
  • 122
0
votes
2 answers

Find filename in Ansible and Save to a file

How can I take filename from a specific directory and use it as a variable? Then I'll use this variable to copy a new file with variable filename For example: In the directory /home/user1/test/ there is always only one file named test1 or some other…
Deema
  • 1
  • 3
0
votes
2 answers

Ansible kerberos auth : user account is failing to connect node

Auth has been changed from basics to kerberos and config changes has been made but in the controller. But while executing ping module the command is failing with below error. Made necessary changes in /etc/krb5.conf controller machine. kinit works…
Sushena
  • 107
  • 3
  • 8
0
votes
1 answer

Ansible Variables registered with with_items, how to use this variable?

I have such a scenario, I need to use two files A.bin, B.bin, first look in the files directory, if not found, download directly from a server - name: Send A.bin and B.bin copy: src={{item}}.bin dest=/opt/ register: is_exist failed_when:…
cydia
  • 103
  • 12