Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible-101: apt should not use with_items #46

Open
ioggstream opened this issue May 28, 2019 · 1 comment
Open

ansible-101: apt should not use with_items #46

ioggstream opened this issue May 28, 2019 · 1 comment
Assignees

Comments

@ioggstream
Copy link
Owner

I expect

apt to use this syntax


- name: Install a list of packages
  apt:
    name: "{{ packages }}"
  vars:
    packages:
    - foo
    - foo-tools

instead

it uses

      apt: name={{item}} state=present
      with_items:
        - python
        - python-dev

Files

# check with 
find . -name \*.yml -exec grep -C4 -nH apt {} \;

@nuvoletta8
Copy link
Collaborator

# Run this with
#
#   #ansible-playbook -i inventory site.yml
#
- hosts: course
  tasks:

    - name: Create a file from a template
      template: src=mytemplate.j2 dest=/tmp/template.conf

    - name: Ensure needed packages are present and eventually install them
      apt: name="{{packages}}"
      vars:
        packages: 
          - python
          - python-dev
      ignore_errors: yes  #  ignore errors during the course (eg. connectivity)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants