From 94c4e56557edac42fb4409d78f9d9e37f934d826 Mon Sep 17 00:00:00 2001 From: vincent Date: Wed, 18 Sep 2019 22:24:19 +0200 Subject: [PATCH] adapt bootstrap for debian --- tasks/main.yml | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 459e4d5..a1d8611 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,10 +1,20 @@ --- # tasks file for ansible_bootstrap +- name: detect debian + raw: uname -a|grep debian||true + register: debian + - name: "install python and archlinux-keyring" raw: pacman -Sy python archlinux-keyring --noconfirm + when: not debian.stdout -- name: upgrade system +- name: "install python for debian" + raw: apt-get install python --assume-yes + when: debian.stdout + + +- name: upgrade system for arch pacman: state: latest # not required. choices: absent;latest;present. Desired state of the package. upgrade: true # not required. Whether or not to upgrade whole system. @@ -12,20 +22,37 @@ update_cache: true become: yes register: upgrade + when: not debian.stdout + +- name: upgrade system for debian + apt: + update_cache: yes # not required. Run the equivalent of C(apt-get update) before the operation. Can be run as part of the package installation or as a separate step. + only_upgrade: yes # not required. Only upgrade a package if it is already installed. + upgrade: full # not required. choices: dist;full;no;safe;yes. If yes or safe, performs an aptitude safe-upgrade.,If full, performs an aptitude full-upgrade.,If dist, performs an apt-get dist-upgrade.,Note: This does not upgrade a specific package, use state=latest for that.,Note: Since 2.4, apt-get is used as a fall-back if aptitude is not present. + state: latest # not required. choices: absent;build-dep;latest;present. Indicates the desired package state. C(latest) ensures that the latest version is installed. C(build-dep) ensures the package build dependencies are installed. + become: yes + when: debian.stdout + register: upgrade + +- debug: + var: upgrade # not required. A variable name to debug. Mutually exclusive with the 'msg' option. + - name: Reboot updates to apply reboot: reboot_timeout: 3600 - when: upgrade.changed and "linux" in upgrade.packages + when: upgrade.changed and "linux" in upgrade.packages and not debian.stdout become: yes - name: sudoers install - pacman: + package: state: present # not required. choices: absent;latest;present. Desired state of the package. name: sudo # not required. Name or list of names of the packages to install, upgrade, or remove. update_cache: true # not required. Whether or not to refresh the master package lists. This can be run as part of a package installation or as a separate step. -- name: create profil + + +- name: create profil user: name: "{{user.name}}" # required. Name of the user to create, remove or modify. skeleton: false # not required. Optionally set a home skeleton directory. Requires create_home option!