O'Reilly logo

OpenStack Administration with Ansible 2 - Second Edition by Walter Bentley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reviewing playbooks and roles

To get right to it, we can start from the top with the role we created named create-users-env. The completed role and file named main.yml located in the create-users-env/tasks directory looks like this:

--- - name: Install random password generator package apt: name={{item}} state=present with_items: - apg - name: Random generate passwords command: apg -n {{ pass_cnt }} -M NCL -q register: passwdss - name: Create users os_user: cloud: "{{CLOUD_NAME}}" state: present name: "{{ item.0 }}" password: "{{ item.1 }}" domain: default with_together: - "{{userid}}" - "{{passwdss.stdout_lines}}" - name: Create user environments os_project: cloud: "{{CLOUD_NAME}}" state: present name: "{{ item }}" description: "{{ item }}" domain_id: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required