ansible-inventory

How to setup ansible playbook that is able to execute kubectl (kubernetes) commands

℡╲_俬逩灬. 提交于 2020-07-22 07:57:09
问题 I'm trying to write simple ansible playbook that would be able to execute some arbitrary command against the pod (container) running in kubernetes cluster. I would like to utilise kubectl connection plugin: https://docs.ansible.com/ansible/latest/plugins/connection/kubectl.html but having struggle to figure out how to actually do that. Couple of questions: Do I need to first have inventory for k8s defined? Something like: https://docs.ansible.com/ansible/latest/plugins/inventory/k8s.html. My

Ansible: using nested groups with vars

浪子不回头ぞ 提交于 2020-07-19 06:15:32
问题 I have a situation where we have 3 tiers of boxes, in each tier we apply different variables settings (like where the cache dir is), but there are a bunch of defaults. I also need to override on a per node basis, which is usually done via inventory vars on the host itself. I am not sure what is the best way to organize the hosts so that the precedence works in my favor. Here are the different things I have tried. In each case I have entries in the inventory file like this: [bots-fancy] fancy

Ansible: using nested groups with vars

情到浓时终转凉″ 提交于 2020-07-19 06:14:54
问题 I have a situation where we have 3 tiers of boxes, in each tier we apply different variables settings (like where the cache dir is), but there are a bunch of defaults. I also need to override on a per node basis, which is usually done via inventory vars on the host itself. I am not sure what is the best way to organize the hosts so that the precedence works in my favor. Here are the different things I have tried. In each case I have entries in the inventory file like this: [bots-fancy] fancy

Ansible: using nested groups with vars

徘徊边缘 提交于 2020-07-19 06:14:11
问题 I have a situation where we have 3 tiers of boxes, in each tier we apply different variables settings (like where the cache dir is), but there are a bunch of defaults. I also need to override on a per node basis, which is usually done via inventory vars on the host itself. I am not sure what is the best way to organize the hosts so that the precedence works in my favor. Here are the different things I have tried. In each case I have entries in the inventory file like this: [bots-fancy] fancy

Ansible stops connecting to the host via ssh [closed]

微笑、不失礼 提交于 2020-07-07 03:27:32
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Improve this question Introduction For over a month I've been running the following command: ansible-playbook -vvvvi host_test rhel-tests.yml Which connected via SSH and ran tests on a host successfully without any problems. But as of the last couple days, I've received the following

Ansible stops connecting to the host via ssh [closed]

天大地大妈咪最大 提交于 2020-07-07 03:27:20
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Improve this question Introduction For over a month I've been running the following command: ansible-playbook -vvvvi host_test rhel-tests.yml Which connected via SSH and ran tests on a host successfully without any problems. But as of the last couple days, I've received the following

Restart mutiple Docker Containers using Ansible not happening

倾然丶 夕夏残阳落幕 提交于 2020-05-17 06:58:46
问题 I am trying to restart my docker containers one by one for a particular image using Ansible but it doesn't seem to be happening. Below is my yml and what it is doing is exiting the current running container. --- - name: restart app servers hosts: shashank-VM connection: local become: yes become_method: sudo tasks: - name: Get info on the Container shell: docker ps | awk '/{{ item }}/{print $1}' register: list_of_containers with_items: - ubuntu - name: Restart Docker Service docker_container:

How do i fix the Broken pipe error during Ansible Play

随声附和 提交于 2020-04-17 22:05:10
问题 I am getting this below error while running my Ansible play. It was working perfectly fine till couple of days ago and suddenly started happening for this particular host. I don't know if some configuration change happened on this server but any idea what could be wrong? The same play works fine for other environment like Prod. Command ansible-playbook -i my-inventory my-main.yml --tags=copyRepo-e my_release_version=5.0.0-4 -e target_env=preprod --ask-become-pass I am able to ssh as well