From d7a8eefeca0ad9cb6e5b6379be92ad4f1c109a72 Mon Sep 17 00:00:00 2001 From: binary Date: Tue, 11 Aug 2020 11:26:12 +0200 Subject: refactored for openbsd setup --- roles/setup_dotfiles/tasks/main.yml | 49 ----------------------------- roles/setup_git/tasks/main.yml | 46 ++------------------------- roles/setup_git/templates/gitweb.service | 25 --------------- roles/setup_git/vars/main.yml | 2 -- roles/setup_hostname/tasks/main.yml | 2 +- roles/setup_mkdocs/tasks/main.yml | 39 ----------------------- roles/setup_mkdocs/templates/mkdocs.service | 24 -------------- roles/setup_mkdocs/vars/main.yml | 17 ---------- roles/setup_python/tasks/main.yml | 21 ------------- roles/update/tasks/main.yml | 23 ++++++-------- 10 files changed, 13 insertions(+), 235 deletions(-) delete mode 100644 roles/setup_dotfiles/tasks/main.yml delete mode 100644 roles/setup_git/templates/gitweb.service delete mode 100644 roles/setup_mkdocs/tasks/main.yml delete mode 100644 roles/setup_mkdocs/templates/mkdocs.service delete mode 100644 roles/setup_mkdocs/vars/main.yml delete mode 100644 roles/setup_python/tasks/main.yml (limited to 'roles') diff --git a/roles/setup_dotfiles/tasks/main.yml b/roles/setup_dotfiles/tasks/main.yml deleted file mode 100644 index 47b73e4..0000000 --- a/roles/setup_dotfiles/tasks/main.yml +++ /dev/null @@ -1,49 +0,0 @@ - -# =========================================================================== # -# __ __ __ _____ __ -# _________ / /__ ____/ /___ / /_/ __(_) /__ _____ -# / ___/ __ \/ / _ \ / __ / __ \/ __/ /_/ / / _ \/ ___/ -# / / / /_/ / / __/ / /_/ / /_/ / /_/ __/ / / __(__ ) -# /_/ \____/_/\___(_) \__,_/\____/\__/_/ /_/_/\___/____/ -# -# =========================================================================== # - ---- -- name: Check installation of zsh - package: - name: zsh - state: present - -- name: Check installation of vim - package: - name: vim - state: present - -- name: Check installation of tmux - package: - name: tmux - state: present - -- name: Copy zshrc configuration file - copy: - src: zshrc - dest: /etc/zshrc - owner: root - group: root - mode: 0644 - -- name: Copy vimrc configuration file - copy: - src: vimrc.local - dest: /etc/vimrc - owner: root - group: root - mode: 0644 - -- name: Copy tmux configuration file - copy: - src: tmux.conf - dest: /etc/tmux.conf - owner: root - group: root - mode: 0644 diff --git a/roles/setup_git/tasks/main.yml b/roles/setup_git/tasks/main.yml index 2383a7c..b2b2d73 100644 --- a/roles/setup_git/tasks/main.yml +++ b/roles/setup_git/tasks/main.yml @@ -15,21 +15,6 @@ name: git state: present -- name: Check installation of lighttpd - package: - name: lighttpd - state: present - -- name: Check installation of libcgi - package: - name: libcgi-pm-perl - state: present - -- name: Check installation of gamin - package: - name: gamin - state: present - - name: Add group git user: name: "{{ git_group }}" @@ -47,8 +32,8 @@ state: present key: "{{ item }}" with_file: - - "{{ playbook_dir }}/files/public_keys/WS-bentonite" - - "{{ playbook_dir }}/files/public_keys/LP-graphite" + - "{{ playbook_dir }}/files/pub_ssh/WS-bentonite" + - "{{ playbook_dir }}/files/pub_ssh/LP-graphite" - name: Create git directory file: @@ -59,30 +44,3 @@ mode: 0755 recurse: True -- name: Create default gitweb directory - file: - path: "{{ git_directory_path }}/{{ git_gitweb_default_repository }}" - state: directory - owner: "{{ git_user }}" - group: "{{ git_group }}" - mode: 0755 - -- name: Init gitweb repository - command: git init "{{ git_directory_path }}/{{ git_gitweb_default_repository }}" - become_user: "{{ git_user }}" - -- name: Copy gitweb systemd unit - template: - src: "{{ git_gitweb_unit }}.service" - dest: "{{ g_systemd_unit_directory }}" - owner: root - group: root - mode: 0644 - -- name: Start gitweb systemd unit - systemd: - name: "{{ git_gitweb_unit }}" - state: restarted - daemon_reload: yes - enabled: yes - diff --git a/roles/setup_git/templates/gitweb.service b/roles/setup_git/templates/gitweb.service deleted file mode 100644 index 12e1eb4..0000000 --- a/roles/setup_git/templates/gitweb.service +++ /dev/null @@ -1,25 +0,0 @@ - -# =========================================================================== # -# _ __ _ __ -# __ ______ (_) /_ ____ _(_) /_ -# / / / / __ \/ / __/ / __ `/ / __/ -# / /_/ / / / / / /__ / /_/ / / /_ -# \__,_/_/ /_/_/\__(_) \__, /_/\__/ -# /____/ -# -# =========================================================================== # - -[Unit] -Description=Gitweb interface for git repositories - -[Service] -Type=forking -User={{ git_user }} -Group={{ git_group }} -WorkingDirectory={{ git_directory_path }}/{{ git_gitweb_default_repository }} -ExecStart=/usr/bin/git instaweb --port={{ g_port_gitweb_gui }} -ExecStop=/bin/kill -s HUP $MAINPID -RuntimeDirectoryMode=0700 - -[Install] -WantedBy=default.target diff --git a/roles/setup_git/vars/main.yml b/roles/setup_git/vars/main.yml index 74983b0..b4f5e64 100644 --- a/roles/setup_git/vars/main.yml +++ b/roles/setup_git/vars/main.yml @@ -13,6 +13,4 @@ git_user: git git_user_comment: handles git repositories and gitweb service git_group: git -git_gitweb_unit: gitweb -git_gitweb_default_repository: __default git_directory_path: /srv/git diff --git a/roles/setup_hostname/tasks/main.yml b/roles/setup_hostname/tasks/main.yml index 326e047..d0e9e62 100644 --- a/roles/setup_hostname/tasks/main.yml +++ b/roles/setup_hostname/tasks/main.yml @@ -9,6 +9,6 @@ # =========================================================================== # --- -- name: Syncrhonize host hostname with config hostname +- name: Synchronize host hostname with config hostname hostname: name: "{{ inventory_hostname }}" diff --git a/roles/setup_mkdocs/tasks/main.yml b/roles/setup_mkdocs/tasks/main.yml deleted file mode 100644 index 83ed41b..0000000 --- a/roles/setup_mkdocs/tasks/main.yml +++ /dev/null @@ -1,39 +0,0 @@ - -# =========================================================================== # -# __ __ __ -# _________ / /__ ____ ___ / /______/ /___ __________ -# / ___/ __ \/ / _ \ / __ `__ \/ //_/ __ / __ \/ ___/ ___/ -# / / / /_/ / / __/ / / / / / / ,< / /_/ / /_/ / /__(__ ) -# /_/ \____/_/\___(_) /_/ /_/ /_/_/|_|\__,_/\____/\___/____/ -# -# =========================================================================== # - ---- -- name: Check mkdocs-material install - pip: - name: mkdocs-material - -- name: Check mkdocs mermaid plugin install - pip: - name: mkdocs-mermaid2-plugin - -- name: Add user mkdocs - user: - name: "{{ mkdocs_user }}" - comment: "{{ mkdocs_user_comment }}" - -- name: Copy syncthing systemd unit - template: - src: "{{ mkdocs_daemon_unit }}.service" - dest: "{{ g_systemd_unit_directory }}" - owner: root - group: root - mode: 0644 - -- name: Start and enable syncthing systemd unit - systemd: - name: "{{ mkdocs_daemon_unit }}" - state: restarted - daemon_reload: yes - enabled: yes - diff --git a/roles/setup_mkdocs/templates/mkdocs.service b/roles/setup_mkdocs/templates/mkdocs.service deleted file mode 100644 index 0befc0d..0000000 --- a/roles/setup_mkdocs/templates/mkdocs.service +++ /dev/null @@ -1,24 +0,0 @@ - -# =========================================================================== # -# _ __ __ __ _ -# __ ______ (_) /_ _______ ______ _____/ /_/ /_ (_)___ ____ _ -# / / / / __ \/ / __/ / ___/ / / / __ \/ ___/ __/ __ \/ / __ \/ __ `/ -# / /_/ / / / / / /__ (__ ) /_/ / / / / /__/ /_/ / / / / / / / /_/ / -# \__,_/_/ /_/_/\__(_) /____/\__, /_/ /_/\___/\__/_/ /_/_/_/ /_/\__, / -# /____/ /____/ -# -# =========================================================================== # - -[Unit] -Description=Webserver for markdown documentation - -[Service] -Type=simple -User={{ mkdocs_user }} -WorkingDirectory={{ mkdocs_files_directory }} -ExecStart=mkdocs serve --dev-addr {{g_ip_mkdocs_gui}}:{{g_port_mkdocs_gui }} -ExecStop=/bin/kill -s HUP $MAINPID -RuntimeDirectoryMode=0700 - -[Install] -WantedBy=default.target diff --git a/roles/setup_mkdocs/vars/main.yml b/roles/setup_mkdocs/vars/main.yml deleted file mode 100644 index 418df91..0000000 --- a/roles/setup_mkdocs/vars/main.yml +++ /dev/null @@ -1,17 +0,0 @@ - -# =========================================================================== # -# __ __ -# _ ______ ___________ ____ ___ / /______/ /___ __________ -# | | / / __ `/ ___/ ___/ / __ `__ \/ //_/ __ / __ \/ ___/ ___/ -# | |/ / /_/ / / (__ ) / / / / / / ,< / /_/ / /_/ / /__(__ ) -# |___/\__,_/_/ /____(_) /_/ /_/ /_/_/|_|\__,_/\____/\___/____/ -# -# =========================================================================== # - ---- -mkdocs_user: mkdocs -mkdocs_user_comment: webserver hosting documentation in markdown -mkdocs_group: null -mkdocs_daemon_unit: mkdocs - -mkdocs_files_directory: /srv/git/infrastructure-docs diff --git a/roles/setup_python/tasks/main.yml b/roles/setup_python/tasks/main.yml deleted file mode 100644 index 033981d..0000000 --- a/roles/setup_python/tasks/main.yml +++ /dev/null @@ -1,21 +0,0 @@ - -# =========================================================================== # -# __ __ __ -# _________ / /__ ____ __ __/ /_/ /_ ____ ____ -# / ___/ __ \/ / _ \ / __ \/ / / / __/ __ \/ __ \/ __ \ -# / / / /_/ / / __/ / /_/ / /_/ / /_/ / / / /_/ / / / / -# /_/ \____/_/\___(_) / .___/\__, /\__/_/ /_/\____/_/ /_/ -# /_/ /____/ -# -# =========================================================================== # - ---- -- name: Check installation of python3-pip - package: - name: python3-pip - state: present - -- name: Check installation of lxml - package: - name: python-lxml - state: present diff --git a/roles/update/tasks/main.yml b/roles/update/tasks/main.yml index 558807e..9783926 100644 --- a/roles/update/tasks/main.yml +++ b/roles/update/tasks/main.yml @@ -9,19 +9,16 @@ # =========================================================================== # --- -- name: Upgrading CentOs packages - dnf: +- name: Copy default mirror for openbsd hosts + copy: + src: installurl + dest: /etc/installurl + owner: root + group: "{{ group_root }}" + when: inventory_hostname in groups["openbsd"] + +- name: Upgrading packages for distribution = {{ ansible_distribution }} + package: name: "*" state: latest - when: ansible_distribution == "CentOs" - -- name: Updating Debian packages - apt: - update_cache: yes - when: ansible_distribution == "Debian" - -- name: Upgrading Debian packages to latest - apt: - upgrade: dist - when: ansible_distribution == "Debian" -- cgit v1.2.3