Questions tagged [ansible-playbook]

468 questions
1
vote
2 answers

Ansible: Fatal error thrown by include_tasks even if a block-rescue block is used

I am trying to include multiple tasks based on some values defined in one hostvar but some fatal errors are thrown even if I'm using the block-rescue block. I have the variable profiles defined in host_vars/hostname.yml: profiles:…
pandoJohn
  • 415
  • 1
  • 5
  • 8
1
vote
1 answer

ansible git autodeploy by webhooks

How to automate deployment from git repository hosted on github / bitbucket to ubuntu server using ansible? In github repostory settings->webhooks i can add webhook for pull to master, that will call my server I have self-made solution, written in…
1
vote
2 answers

How to run different role for different hosts in single ansible playbook?

I have 3 ansible playbook. my_ansible ├── hosts ├── play1.yaml ├── play2.yaml ├── play3.yaml └── roles    ├── role1    ├── role2    └── role3 hosts [play1] host1 [play2] host2 [play3] host3 Now, when I run play3, I want to run play2(role2) on…
Nilesh
  • 255
  • 1
  • 6
  • 18
1
vote
3 answers

ansible error: Failed to find required executable rsync in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin"}

- hosts: host1 remote_user: root tasks: - synchronize: src: /etc/httpd dest: /mytestfile Iam getting the following error.Could anyone help PLAY [host1]…
arun mohan
  • 183
  • 2
  • 2
  • 9
1
vote
1 answer

Ansible: list all variables required for a playbook

Given a playbook --- - hosts: some_host_group roles: - foo - bar I'd like to get the list of all variables that the playbook needs to be defined. Something like: # playbook-requires myplaybook.yml For more elaborate (or just numerous)…
badbishop
  • 928
  • 4
  • 12
  • 21
1
vote
1 answer

Ansible uri modules changed_when check fails

I am using uri module of Ansible 2.0. I have code like this to make POST on a api. - name: Example POST uri: url: http://example.com:8001/api method: POST status_code: 201 body_format: json body: …
Madoc Comadrin
  • 570
  • 4
  • 11
  • 29
1
vote
2 answers

Git pull from bitbucket using ansible and jenkins

Hi everyone I am new on ansible, I am working on Ubuntu 16.04 and ansible 2.2, how to pull bitbucket repository to remote server using ansible? I have connected to the hosts and able to ping or running simple command using my ansible to the remote…
spacetrack
  • 21
  • 1
  • 4
1
vote
2 answers

Conventions for start/stop commands in Ansible playbooks

I'm a new Ansible user and enjoying it so far. I'm using Ansible to define and apply webserver configurations. I'm using playbooks. Say I have a role to install and configure Nginx, the tasks are defined at roles/nginx/tasks/main.yml and referenced…
Bruce
  • 135
  • 1
  • 6
1
vote
1 answer

Ansible not restarting service correctly

I am trying to restart the vsftpd service using a handler, based on changes to the config file. I have the following code in tasks/main.yaml: - name: copy vsftpd.conf template: src=vsftpd.conf.j2 dest={{vsftpd_config_file}} backup=yes become:…
ebarrere
  • 330
  • 1
  • 3
  • 15
1
vote
1 answer

Ansible to access Github: become causes Permission denied (publickey)

Objective Would like to understand the mechanism why using become to be the ansible user causes "Permission denied (publickey)". User ansible to run ansible-playbook to checkout a Github repository. SSH keys have been copied with ssh-copy-id with…
mon
  • 235
  • 3
  • 10
1
vote
2 answers

Ansible list variable undefined

I have a playbook which runs a custom task to set up an nginx vhost: tasks: - include: tasks/tweaks.yml In this playbook, the following var_files are used: vars_files: - ../config.yml In config.yml I have the following list which holds…
williamsowen
  • 1,167
  • 3
  • 16
  • 25
1
vote
1 answer

Can I get dependent roles installed as part of running the playbook?

Using Vagrant's ansible_local provisioner, how can I ensure the roles used in my playbook are installed before Ansible tries to execute them? I tried to install the role with shell: ansible-galaxy ... in both a preceding task block and as part of…
Davor Cubranic
  • 365
  • 2
  • 9
1
vote
2 answers

Is it possible to notify a group of services instead of individual in Ansible?

- name: be sure check-http.rb is copied copy: src: /tmp/sensu-plugins-http/bin/check-http.rb dest: /etc/sensu/plugins/check-http.rb remote_src: true owner: sensu group: sensu mode: 0500 notify: - restart sensu-api …
030
  • 5,901
  • 13
  • 68
  • 110
1
vote
2 answers

delete multiple directories with ansible

Hellos. I need to delete a few directories on a group of machines. I can't seem to get the file module to do my bidding. The below module will run without error and does not delete anything. I do not want to remove /opt. - hosts: [dummies] tasks: …
mr.zog
  • 923
  • 3
  • 20
  • 39
1
vote
1 answer

Windows Server 2012 R2 not downloading recommended updates

I have multiple Windows Server 2012 R2 running on Azure (IaaS VM's). We perform monthly maintenances on these servers via Ansible, this includes Windows updates (recommended and critical updates). This works for 90+% of our servers, but some servers…