ansible

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

How do i fix the Broken pipe error during Ansible Play

淺唱寂寞╮ 提交于 2020-04-17 22:00:44
问题 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

Is it possible to have ansible use a “remote” playbook for git-based continuous deployment?

别等时光非礼了梦想. 提交于 2020-04-16 04:57:10
问题 I need to manage a few servers that run code that is currently being deployed there as a couple of git repositories. I would like to be able to store in the project's repository the parts (if not all) of the playbook that is relevant for the repository. For example, the list of package dependencies, virtualenv requirements, configuration templates. This will also allow those to change in a per branch/commit way. Meaning I can make sure that if I need to deploy a specific branch/commit,

Is it possible to have ansible use a “remote” playbook for git-based continuous deployment?

可紊 提交于 2020-04-16 04:56:59
问题 I need to manage a few servers that run code that is currently being deployed there as a couple of git repositories. I would like to be able to store in the project's repository the parts (if not all) of the playbook that is relevant for the repository. For example, the list of package dependencies, virtualenv requirements, configuration templates. This will also allow those to change in a per branch/commit way. Meaning I can make sure that if I need to deploy a specific branch/commit,

How to define group_var for multiple host in same environment

a 夏天 提交于 2020-04-16 04:49:10
问题 I am writing a Ansible playbook which copy and deploy multiple wars to different servers of same environment. For example, my preprod environment has 4 different servers and on every release I get 5 war files let's say test1.war, test2.war... test5.war. They should be deployed in this way - PreProd - server1 : test1.war, test2.war - server2 : test2.war, test5.war - server3 : test3.war, test1.war, test5.war AND so on. Now I am using group_vars to define all the variables related to preprod at

Ansible中shell,command,raw模块的区别

社会主义新天地 提交于 2020-04-15 23:51:16
【推荐阅读】微服务还能火多久?>>> command shell raw 模块之间的区别 command,shell,raw模块都是ansible远程执行node服务器的一种指令模式 但是3个模块的适用还是有一定的区别 command 模块 The command module takes the command name followed by a list of space-delimited arguments. The given command will be executed on all selected nodes. It will not be processed through the shell, so variables like $HOME and operations like "<", ">", "|", and "&" will not work (use the shell module if you need these features). 注解:command模块不是调用的shell的指令,所以没有bash的环境变量,也不能使用shell的一些操作方式,其他和shell没有区别 http://docs.ansible.com/ansible/command_module.html#command shell 模块 The shell

自动化运维工具Ansible-基础介绍(一)

走远了吗. 提交于 2020-04-13 11:54:16
【今日推荐】:为什么一到面试就懵逼!>>> 自动化运维工具Ansible-基础介绍 1、简介 ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、cfengine、chef、func、fabric)的优点,实现了批量系统配置、批量程序部署、批量运行命令等功能。ansible是基于模块工作的,本身没有批量部署的能力。真正具有批量部署的是ansible所运行的模块,ansible只是提供一种框架。主要包括: (1)、连接插件connection plugins:负责和被监控端实现通信; (2)、host inventory:指定操作的主机,是一个配置文件里面定义监控的主机; (3)、各种模块核心模块、command模块、自定义模块; (4)、借助于插件完成记录日志邮件等功能; (5)、playbook:剧本执行多个任务时,非必需可以让节点一次性运行多个任务。 2、特性 (1)、no agents:不需要在被管控主机上安装任何客户端; (2)、no server:无服务器端,使用时直接运行命令即可; (3)、modules in any languages:基于模块工作,可使用任意语言开发模块; (4)、yaml not code:使用yaml语言定制剧本playbook; (5)、ssh by default:基于SSH工作; (6)

Ansible, with_subelements and skip_missing does not work

时光怂恿深爱的人放手 提交于 2020-04-12 06:53:26
问题 I have the following problem: A host_var defining my nginx sites (excerpt): nginx_sites: - server: name: site1 location1: config: name: "/" [...] - server: name: site2 location1: config: name: "/" [...] location2: config: name: "/secretspace" [...] htaccess: username: password: somepassword In this example I have 2 sites. The second one has two locations where the second one has a subelement named "htaccess". This is what I want to use in order to create an corresponding htaccess file. I

Ansible strip white space

|▌冷眼眸甩不掉的悲伤 提交于 2020-04-11 03:57:39
问题 When I try to run some commands on nxos devices, the output has a white space at the end. I have to compare the output to an existing variable list. The whitespace at the end is causing the comparison to go false. How to make use of .strip() function in a list of strings? - name: Current TACACS server host before nxos_command: commands: - sh run | include 'tacacs-server host' register: runconfserafter - debug: var: runconfserafter The output of this comes up like this: "stdout_lines": [ [

Ansible strip white space

≡放荡痞女 提交于 2020-04-11 03:57:30
问题 When I try to run some commands on nxos devices, the output has a white space at the end. I have to compare the output to an existing variable list. The whitespace at the end is causing the comparison to go false. How to make use of .strip() function in a list of strings? - name: Current TACACS server host before nxos_command: commands: - sh run | include 'tacacs-server host' register: runconfserafter - debug: var: runconfserafter The output of this comes up like this: "stdout_lines": [ [