Modernize Ansible playbooks: replace deprecated syntax (include: -> include_tasks:, with_items -> loop), use ansible.builtin modules, organize variables (defaults/main.yml), standardize tags, add prerequisites assertions and meta/main.yml
This commit is contained in:
@@ -3,8 +3,11 @@
|
||||
# CRéation des groupes
|
||||
# ---------------------------------------------------
|
||||
- name: Création des groupes
|
||||
group: name={{ item.group }} gid={{ item.gid }} state=present
|
||||
with_items:
|
||||
ansible.builtin.group:
|
||||
name: "{{ item.group }}"
|
||||
gid: "{{ item.gid }}"
|
||||
state: present
|
||||
loop:
|
||||
- { group: oinstall, gid: 1001}
|
||||
- { group: dba, gid: 1002 }
|
||||
- { group: oper, gid: 1003 }
|
||||
@@ -23,11 +26,17 @@
|
||||
# Création des utilisateurs : password Oracle123 => full configuration
|
||||
# ---------------------------------------------------
|
||||
- name: Création du compte Oracle et grid
|
||||
user:
|
||||
name={{ item.username }} group={{ item.primgroup }}
|
||||
groups={{ item.othergroups }} uid={{ item.uid }}
|
||||
generate_ssh_key=yes append=yes state=present update_password=on_create password={{ item.passwd }}
|
||||
with_items:
|
||||
ansible.builtin.user:
|
||||
name: "{{ item.username }}"
|
||||
group: "{{ item.primgroup }}"
|
||||
groups: "{{ item.othergroups }}"
|
||||
uid: "{{ item.uid }}"
|
||||
generate_ssh_key: yes
|
||||
append: yes
|
||||
state: present
|
||||
update_password: on_create
|
||||
password: "{{ item.passwd }}"
|
||||
loop:
|
||||
- { username: oracle, uid: 1001, primgroup: oinstall, othergroups: "dba,asmdba,backupdba,dgdba,kmdba,racdba,oper", passwd: "$6$0xHoAXXF$K75HKb64Hcb/CEcr3YEj2LGERi/U2moJgsCK.ztGxLsKoaXc4UBiNZPL0hlxB5ng6GL.gyipfQOOXplzcdgvD0"}
|
||||
- { username: grid, uid: 1002, primgroup: oinstall, othergroups: "dba,asmdba,backupdba,dgdba,kmdba,racdba,asmoper,asmadmin", passwd: "$6$0xHoAXXF$K75HKb64Hcb/CEcr3YEj2LGERi/U2moJgsCK.ztGxLsKoaXc4UBiNZPL0hlxB5ng6GL.gyipfQOOXplzcdgvD0"}
|
||||
ignore_errors: true
|
||||
@@ -40,8 +49,12 @@
|
||||
# ---------------------------------------------------
|
||||
- name: Ajout du compte oracle et grid au sudoers
|
||||
ignore_errors: true
|
||||
template: src=sudoers.j2 dest=/etc/sudoers.d/{{ item }} owner=root mode=0600
|
||||
with_items:
|
||||
ansible.builtin.template:
|
||||
src: sudoers.j2
|
||||
dest: "/etc/sudoers.d/{{ item }}"
|
||||
owner: root
|
||||
mode: "0600"
|
||||
loop:
|
||||
- oracle
|
||||
- grid
|
||||
tags: sudoadd
|
||||
Reference in New Issue
Block a user