ansible-playbook

ansible wget then exec scripts => get_url equivalent

房东的猫 提交于 2019-12-28 13:46:44
问题 I always wonder what is the good way to replace the following shell tasks using the "ansible way" (with get_url , etc.): - name: Install oh-my-zsh shell: wget -qO - https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | bash - or - name: Install nodesource repo shell: curl -sL https://deb.nodesource.com/setup_5.x | bash - 回答1: This worked for me: - name: Download zsh installer get_url: url=https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh dest=/tmp/zsh

Run ansible on specific hosts group

你说的曾经没有我的故事 提交于 2019-12-25 07:49:46
问题 I am trying to run ansible with the following command, ansible-playbook provision.yml -l webserver And my hosts file contains the following host groups, [webclient] 172.29.4.75 [webserver] 172.29.4.76 My provision.yml also contains 2 hosts as below, - hosts: webclient user: centos roles: - nginx - nvm - hosts: webserver user: centos roles: - tomcat My issue here is even thought I use "-l webserver" roles specified for webclient also runs in webclient hosts. How can I control it to run only

Error trying to create a new vm in ansible

 ̄綄美尐妖づ 提交于 2019-12-25 07:19:56
问题 I just started learning Ansible. It has been a pain so far. I have this code to create a new vm. I followed this tutorial. --- - hosts: localhost connection: local tasks: - vsphere_guest: vcenter_hostname:1.1.1.12 username: root password: pasword guest: newvm001 state: powered_on validate_certs: no vm_extra_config: vcpu.hotadd: yes mem.hotadd: yes notes: This is a test VM folder: MyFolder vm_disk: disk1: size_gb: 10 type: thin datastore: storage001 vm_nic: nic1: type: vmxnet3 network: VM

Adding new sudo user using ansible - “password”: “NOT_LOGGING_PASSWORD” message

旧巷老猫 提交于 2019-12-25 06:44:50
问题 I'm using Vagrant (Virtual Box provider) to setup a local Virtual Machine. I'm also using ansible and more specific ansible_local (Vagrant plugin) to deploy some tools into the VM. Initially I'm trying to create a new user following the ansible documentation. --- - name: Master Node hosts: 127.0.0.1 connection: local user: root vars_files: - vars/vars.yml vars: username: nikolas tasks: - name: Adding user user: name={{username}} shell=/bin/bash groups=root append=yes password={{pass}} sudo:

Pulling git repo to a vagrant box using ansible

旧时模样 提交于 2019-12-25 04:46:23
问题 Hi all I am trying to pull a repo from my github to a vagrant box via ansible, refering this github issue. I have registered an ssh from my host with the github. And below is the part in the playbook where I'm trying to pull; - name: install git apt: name=git - name: create the ssh public key file copy: src=/home/user/.ssh/id_rsa.pub dest=/root/.ssh/id_rsa.pub mode=0644 - name: create the ssh private key file copy: src=/home/user/.ssh/id_rsa dest=/root/.ssh/id_rsa mode=0600 - name: setup git

~/.ssh/id_rsa.pub not found error while installing capistrano as ansible playbook

空扰寡人 提交于 2019-12-25 03:15:46
问题 I try to install https://github.com/roots/bedrock-ansible to get a bedrock deployment (http://roots.io/wordpress-stack/) running. When I run "vagrant up", after some time I get the error: TASK: [capistrano-setup | Setup deploy group] ********************************* skipping: [default] TASK: [capistrano-setup | Setup deploy user] ********************************** skipping: [default] TASK: [capistrano-setup | Adding public key to server] ************************ fatal: [default] => could not

Deploy Ansible project which include a docker-compose.yml

让人想犯罪 __ 提交于 2019-12-25 01:24:18
问题 I woud like to use Ansible to deploy one of my project (let's call it project-to-deploy ). project-to-deploy can be run locally using a docker-compose.yml file, which, among other things, mount the following volumes inside the docker-container . version: "2" services: database: image: mysql:5.6 volumes: - ./docker/mysql.init.d:/docker-entrypoint-initdb.d messages: image: private.repo/project-to-deploy:latest Nothing more useful here. To run the project: docker-compose up . I have created a

How to let Ansible to skip run tasks on a host when its already configured?

佐手、 提交于 2019-12-24 13:04:08
问题 We have 2 playbooks Basic-env and Upgrade-env to manager our hosts. The ansible-playbook Basic-env is doing the the basic environment setup(yum, generate keys, security tasks) and register the services. The ansible-playbook Upgrade-env is doing the non-disruptive Upgrade(NDU) for the software and configuration. We will dynamic put new hosts into inventory, and run Basic-env each 10 mins. Question : Is possible to let ansible skip execute the tasks which in Basic-env at old hosts and only run

ansible - cisco IOS and “reload” command

浪子不回头ぞ 提交于 2019-12-24 07:35:07
问题 I would like to send command "reload in " to Cisco IOS, but that specific command needs to be confirmed like below: #reload in 30 Reload scheduled in 30 minutes by admin on vty0 (192.168.253.15) Proceed with reload? [confirm] It semms like ios_command module doesn't handle such case. My configuration: tasks: - name: do reload in case of "catting off" ios_command: commands: reload in 30 commands: y provider: "{{ cli }}" And response from playbook: TASK [do reload in case of "catting off"] ****

Merging shared parameters with environment specific parameter in Ansible

拜拜、爱过 提交于 2019-12-24 01:58:15
问题 I run my playbooks specifying the target server environment on the command line, e.g.: ansible-playbook -e env=staging playbook.yml Now I want to be able to provide parameters, e.g. dictionary of users to create on the server in such a way that there are users common to all environments, and also users that are specific to that one environment for which I run the playbook. The directory structure could look like this: ├── group_vars │ ├── all │ │ ├── users.yml │ │ │ ├── development │ │ ├──