ansible-inventory

how to specify user name in host file of ansible

本小妞迷上赌 提交于 2021-02-18 10:03:45
问题 I am using the host file as below, [qa-workstations] 10.39.19.190 ansible_user=test ansible_ssh_pass=test I am using below command to execute "whoami" command in host root@Svr:~/ansible# ansible all -a "whoami" -i /etc/ansible/host 10.39.19.190 | success | rc=0 >> root ansible by default trying to use user name in which I have logged in, i.e root instead of test user which I have specified in host file It works fine when I try to pass the username in ansible cli command root@Svr:~/ansible#

Ansible provisioning ERROR! Using a SSH password instead of a key is not possible

醉酒当歌 提交于 2021-02-05 21:35:25
问题 I would like to provision with my three nodes from the last one by using Ansible. My host machine is Windows 10. My Vagrantfile looks like: Vagrant.configure("2") do |config| (1..3).each do |index| config.vm.define "node#{index}" do |node| node.vm.box = "ubuntu" node.vm.box = "../boxes/ubuntu_base.box" node.vm.network :private_network, ip: "192.168.10.#{10 + index}" if index == 3 node.vm.provision :setup, type: :ansible_local do |ansible| ansible.playbook = "playbook.yml" ansible.provisioning

Ansible provisioning ERROR! Using a SSH password instead of a key is not possible

天涯浪子 提交于 2021-02-05 21:35:09
问题 I would like to provision with my three nodes from the last one by using Ansible. My host machine is Windows 10. My Vagrantfile looks like: Vagrant.configure("2") do |config| (1..3).each do |index| config.vm.define "node#{index}" do |node| node.vm.box = "ubuntu" node.vm.box = "../boxes/ubuntu_base.box" node.vm.network :private_network, ip: "192.168.10.#{10 + index}" if index == 3 node.vm.provision :setup, type: :ansible_local do |ansible| ansible.playbook = "playbook.yml" ansible.provisioning

Ansible Playbook throwing this error - failed to transfer file to /tmp

醉酒当歌 提交于 2021-01-29 22:18:54
问题 I am getting bugged by this unknown error while running my playbook. My playbook does multiple things using roles like downloading the release war files from nexus (my application has 10 war files), copying it to remote host, creating webapp folder, exploding the war etc. It is getting failed by the below error during Unarchive module - Playbook Command - ./ansible-playbook my-main.yml --tags=repodownload,copyrepo,explodewar,starttomcat -e my_release_version=1.0.0-01 -e target_env=preprod

Ansible Playbook throwing this error - failed to transfer file to /tmp

耗尽温柔 提交于 2021-01-29 21:36:57
问题 I am getting bugged by this unknown error while running my playbook. My playbook does multiple things using roles like downloading the release war files from nexus (my application has 10 war files), copying it to remote host, creating webapp folder, exploding the war etc. It is getting failed by the below error during Unarchive module - Playbook Command - ./ansible-playbook my-main.yml --tags=repodownload,copyrepo,explodewar,starttomcat -e my_release_version=1.0.0-01 -e target_env=preprod

Ansible Playbook throwing this error - failed to transfer file to /tmp

删除回忆录丶 提交于 2021-01-29 19:00:55
问题 I am getting bugged by this unknown error while running my playbook. My playbook does multiple things using roles like downloading the release war files from nexus (my application has 10 war files), copying it to remote host, creating webapp folder, exploding the war etc. It is getting failed by the below error during Unarchive module - Playbook Command - ./ansible-playbook my-main.yml --tags=repodownload,copyrepo,explodewar,starttomcat -e my_release_version=1.0.0-01 -e target_env=preprod

Ansible access same group vars different children host groups

血红的双手。 提交于 2021-01-29 05:32:41
问题 I am trying to run a role which loops based on a parent group (or parent of parent group) with two or more child groups with certain number of hosts. The two child groups have same group_vars so I tried to define the group_vars separately for each child group but executing the role only inherits group_vars from either of the child group. I understand about the Ansible variable merging but my specific use case (want to run same role at different hierarchies of host groups) needs to load the

Ansible - Set environment path as inventory variable

和自甴很熟 提交于 2021-01-28 12:20:02
问题 Osmc media player needs a specific path for playbooks https://github.com/osmc/osmc/issues/319 environment: PATH: "{{ ansible_env.PATH }}:/sbin:/usr/sbin" I was wondering whether I can set this as an environmental variable in the inventory for those machines, rather than have it in every playbook or create separate playbooks. In common usage - is that path likely to cause problems for general *nix machines if it is implemented on non-osmc installations? If you can't set this an an inventory

Specifying multiple default groups as hosts in an Ansible playbook

情到浓时终转凉″ 提交于 2021-01-28 01:50:55
问题 I'm looking for a way to specify multiple default groups as hosts in an Ansible playbook. I've been using this method: - name: Do things on hosts hosts: "{{ specific_hosts | default('development') }}" tasks: # do things on hosts However I'm trying to avoid specifying hosts manually (it is error-prone), and the default hosts are inadequate if I want to run the same tasks against multiple groups of servers (for instance, development and QA). I don't know if this is possible in a playbook: -

Concatenate strings using with_items and assign to a variable in Ansible

房东的猫 提交于 2020-12-06 12:31:06
问题 I need to save two 2 IPs to a variable in a vars_file when launching ec2_instances, which are used later during deployment. This is how I am saving a single server ip: - name: Save server public IP to vars file lineinfile: line="server_public_ip{{':'}} {{ item.public_ip }}" dest="{{ansible_env.HOME}}/dynamic_ips_{{ec2_environment}}" with_items: server.instances #server is registered in previous task The output I have in dynamic_ips file is server_public_ip: xxx.xxx.xx.x Now I have 2 servers