- lineinfile:
path: /etc/hosts
regexp: '^127\.0\.0\.1'
line: '127.0.0.1 localhost'
owner: root
group: root
mode: 0644
---
- hosts: win
gather_facts: true
# ansible_connection: winrm
tasks:
name: Download and install application, 32 bit case
win_package:
path: 'https://download-cf.jetbrains.com/[path-of-the-32-bits-edition].exe'
product_id: "PhpStorm"
arguments: /S /install
state: present
when: ansible_architecture == "32 bits"
name: Download and install application, 64 bit case
win_package:
path: 'https://download-cf.jetbrains.com/[path-of-the-64-bits-edition].exe'
product_id: "PhpStorm"
arguments: /S /install
state: present
when: ansible_architecture == "64 bits"
Ansible loads plugins automatically too, loading each type of plugin separately from a directory named for the type of plugin. Here’s the full list of plugin directory names:
action_plugins*
cache_plugins
callback_plugins
connection_plugins
filter_plugins*
inventory_plugins
lookup_plugins
shell_plugins
strategy_plugins
test_plugins*
vars_plugins
To load your local plugins automatically, create or add them in any of these locations:
any directory added to the relevant ANSIBLE_plugin_type_PLUGINS environment variable (these variables, such as $ANSIBLE_INVENTORY_PLUGINS and $ANSIBLE_VARS_PLUGINS take colon-separated lists like $PATH)
the directory named for the correct plugin_type within ~/.ansible/plugins/ - for example, ~/.ansible/plugins/callback
the directory named for the correct plugin_type within /usr/share/ansible/plugins/ - for example, /usr/share/ansible/plugins/action
- name: create users
user:
name: "{{ item }}"
createhome: yes
state: present
password: "{{ lookup('password', '/tmp/' + ansible_host + '_' + item + '_password.txt encrypt=md5_crypt chars=ascii_letters,digits length=1
update_password: on_create
with_items:
- "{{ users }}"
register: newuser