solution
This commit is contained in:
70
tco.setup/tasks/main.yml
Normal file
70
tco.setup/tasks/main.yml
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
# tasks file for tco.setup
|
||||
- name: import os var file
|
||||
ansible.builtin.include_vars: "{{ ansible_os_family | lower }}.yml"
|
||||
tags: always
|
||||
|
||||
- name: warn people
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/motd
|
||||
create: yes
|
||||
line: "Host is managed by ansible, manual interaction not recommended"
|
||||
state: present
|
||||
|
||||
- name: history
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/history
|
||||
line: "{{ '%Y-%m-%d' | strftime }} - {{ ansible_play_name }} - {{ playbook_version }}"
|
||||
state: present
|
||||
create: true
|
||||
|
||||
- name: generate ssh keys
|
||||
openssh_keypair:
|
||||
path: "~/.ssh/id_rsa"
|
||||
size: 2048
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
|
||||
- name: create account
|
||||
ansible.builtin.user:
|
||||
name: ansible
|
||||
password: "{{ '123Soleil%' | password_hash('sha512',65534|random(seed=inventory_hostname) | string) }}"
|
||||
create_home: yes
|
||||
home: /home/ansible
|
||||
|
||||
- name: configure sudo
|
||||
ansible.builtin.copy:
|
||||
src: sudoers
|
||||
dest: /etc/sudoers.d/ansible
|
||||
|
||||
- name: deploy ssh key
|
||||
ansible.posix.authorized_key:
|
||||
user: ansible
|
||||
key: "{{ item }}"
|
||||
loop:
|
||||
- "{{ lookup( 'file', '~/.ssh/id_rsa.pub' ) }}"
|
||||
- "https://infra.opendoor.fr/id_rsa.pub"
|
||||
|
||||
tags: vim
|
||||
ansible.builtin.package:
|
||||
name: "{{ vim_package }}"
|
||||
state: present
|
||||
|
||||
- name: install prereq
|
||||
tags: vim
|
||||
package:
|
||||
name: git
|
||||
state: present
|
||||
|
||||
- name: get vim configuration
|
||||
tags: vim
|
||||
ansible.builtin.git:
|
||||
repo: https://infra.opendoor.fr/git/tom/vim_formation
|
||||
dest: /tmp/vim_formation
|
||||
|
||||
- name: install vim configuration
|
||||
tags: vim
|
||||
ansible.builtin.copy:
|
||||
src: /tmp/vim_formation/vimrc
|
||||
dest: "{{ vim_config_dir }}/vimrc"
|
||||
remote_src: true
|
||||
Reference in New Issue
Block a user