diff --git a/defaults/main.yml b/defaults/main.yml index e69de29..5fa57bb 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -0,0 +1 @@ +username: user \ No newline at end of file diff --git a/tasks/AUR_builder.yml b/tasks/AUR_builder.yml new file mode 100644 index 0000000..4e6b285 --- /dev/null +++ b/tasks/AUR_builder.yml @@ -0,0 +1,28 @@ +- name: install base-devel package + pacman: + state: present # not required. choices: absent;latest;present. Desired state of the package. + upgrade: false # not required. Whether or not to upgrade whole system. + name: ['base-devel'] # not required. Name or list of names of the packages to install, upgrade, or remove. + become: yes + +- name: Create aur_builder user + user: + name: aur_builder + group: wheel + become: yes + +- name: Allow aur_builder to run pacman as root + lineinfile: + path: /etc/sudoers.d/11-install-aur_builder + line: 'aur_builder ALL=(ALL) NOPASSWD: /usr/bin/pacman' + create: yes + validate: 'visudo -cf %s' + become: yes + +- name: install yay + aur: + skip_installed: True + name: yay + use: makepkg + become: yes + become_user: aur_builder diff --git a/tasks/base_software.yml b/tasks/base_software.yml new file mode 100644 index 0000000..8ceec97 --- /dev/null +++ b/tasks/base_software.yml @@ -0,0 +1,14 @@ +- name: launch base install software + pacman: + state: present # not required. choices: absent;latest;present. Desired state of the package. + name: ['zsh','stow','awesome-terminal-fonts','wget','bat','diff-so-fancy','git','htop','thefuck','tldr','ntfs-3g','tmux','vim','zsh-theme-powerlevel9k' ] # 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. + become: yes + +- name: install oh-my-zsh-git + aur: + skip_installed: True + name: oh-my-zsh-git + use: yay + become: yes + become_user: aur_builder \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index e69de29..c41da13 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- include_tasks: AUR_builder.yml +- include_tasks: base_software.yml +- include_tasks: user_config_file.yml diff --git a/tasks/user_config_file.yml b/tasks/user_config_file.yml new file mode 100644 index 0000000..5bb5784 --- /dev/null +++ b/tasks/user_config_file.yml @@ -0,0 +1,22 @@ +- name: clone user repository + git: + dest: ~/conf2 # required. The path of where the repository should be checked out. This parameter is required, unless C(clone) is set to C(no). + repo: ssh://git@pi2/vincent/conf2.git # required. git, SSH, or HTTP(S) protocol address of the git repository. + clone: yes # not required. If C(no), do not clone the repository if it does not exist locally + force: no + update: no + accept_hostkey: yes + + +- name: pass user shell to zsh + user: + name: "{{username}}" # required. Name of the user to create, remove or modify. + shell: /bin/zsh # not required. Optionally set the user's shell.,On macOS, before version 2.5, the default shell for non-system users was /usr/bin/false. Since 2.5, the default shell for non-system users on macOS is /bin/bash. + state: present # not required. choices: absent;present. Whether the account should exist or not, taking action if the state is different from what is stated. + become: yes + +- name: apply stow config + shell: stow * + args: + chdir: ~/conf2 + creates: "~/.zshrc.d/alias" # not required. a filename, when it already exists, this step will B(not) be run.