From 480d738c5978de3d1ef0880d7b643e9502123693 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Thu, 17 Nov 2016 16:52:12 +0200 Subject: [PATCH] - Added pre-commit checks. - Pass all pre-commits checks (mainly ansible-lint). --- .pre-commit-config.yaml | 15 ++++++++++----- desktop.yml | 3 ++- dropbox.yml | 7 ++++--- pkgs.yml | 17 +++++++++-------- skype.yml | 3 ++- templates/landrush.j2 | 1 + templates/landrush.service.j2 | 7 +++++++ workstation.yml | 5 +++-- 8 files changed, 38 insertions(+), 20 deletions(-) create mode 100644 templates/landrush.j2 create mode 100644 templates/landrush.service.j2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7788bf8..1de57c8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,18 @@ - repo: https://github.com/pre-commit/pre-commit-hooks - sha: 6dfcb89af3c9b4d172cc2e5a8a2fa0f54615a338 + sha: 7539d8bd1a00a3c1bfd34cdb606d3a6372e83469 hooks: - id: check-added-large-files - id: check-json - id: check-xml - id: check-yaml - id: check-merge-conflict -- repo: https://www.shore.co.il/git/ansible-pre-commit/ - sha: 94b506c144d4e22ebc1deef637a818db13bcaca5 + - id: check-symlinks +- repo: https://www.shore.co.il/git/ansible-pre-commit + sha: 0fadd691465b97db8992cfc66650f630e433324b hooks: - - id: ansible-pre-commit - files: (pkgs|dropbox|skype|desktop)\.yml$ + - id: ansible-syntax-check + files: \.yml$ +- repo: https://github.com/willthames/ansible-lint + sha: 959ab0f525e9abb19cf75f34381015cf33695f61 + hooks: + - id: ansible-lint diff --git a/desktop.yml b/desktop.yml index 9db1ee5..13e92dd 100644 --- a/desktop.yml +++ b/desktop.yml @@ -10,7 +10,8 @@ command: /usr/sbin/update-grub tasks: - - assert: + - name: Assertions + assert: that: - ansible_pkg_mgr == 'apt' diff --git a/dropbox.yml b/dropbox.yml index 90f030b..67662b5 100644 --- a/dropbox.yml +++ b/dropbox.yml @@ -2,12 +2,13 @@ - hosts: all become: no tasks: - - assert: + - name: Assertions + assert: that: - ansible_architecture == 'x86_64' - name: Verify that Python is installed - shell: python --version + command: python --version changed_when: False - name: Download Dropbox tarball @@ -18,11 +19,11 @@ register: download_dropbox_tarball - name: Unpack Dropbox tarball - when: '{{ download_dropbox_tarball.changed }}' unarchive: copy: no dest: '{{ ansible_user_dir }}/' src: '{{ ansible_user_dir }}/Downloads/dropbox-lnx.x86_64.tar.gz' + creates: '{{ ansible_user_dir }}/.dropbox-dist/dropboxd' - name: Get Python Dropbox startup script get_url: diff --git a/pkgs.yml b/pkgs.yml index 6865dbe..27b6f7f 100644 --- a/pkgs.yml +++ b/pkgs.yml @@ -120,7 +120,7 @@ - vim-nox - vinagre - virtualbox-qt - - xdg-user-dirs + - xdg-user-dirs go: - github.com/giantswarm/semver-bump - github.com/nishanths/license @@ -147,7 +147,8 @@ - rustfmt tasks: - - assert: + - name: Assertions + assert: that: - ansible_pkg_mgr == 'apt' @@ -157,7 +158,7 @@ become_user: root apt: name: '{{ apt|join(" ") }}' - state: latest + state: present purge: yes force: yes update_cache: yes @@ -165,7 +166,7 @@ - name: go get when: go is iterable - shell: 'go get -u {{ go|join(" ") }}' + command: 'go get -u {{ go|join(" ") }}' - name: gem install when: gem is iterable @@ -173,7 +174,7 @@ become_user: root gem: name: '{{ gem|join(" ") }}' - state: latest + state: present - name: npm install when: npm is iterable @@ -182,7 +183,7 @@ npm: global: yes name: '{{ npm|join(" ") }}' - state: latest + state: present - name: pip install when: pip is iterable @@ -190,7 +191,7 @@ become_user: root pip: name: '{{ pip|join(" ") }}' - state: latest + state: present - name: pip3 install when: pip3 is iterable @@ -198,7 +199,7 @@ become_user: root pip: name: '{{ pip3|join(" ") }}' - state: latest + state: present executable: pip3 - name: cargo install diff --git a/skype.yml b/skype.yml index ba0bb2e..a2b0a66 100644 --- a/skype.yml +++ b/skype.yml @@ -3,7 +3,8 @@ become: yes become_user: root tasks: - - assert: + - name: Assertions + assert: that: - ansible_architecture in [ 'x86_64', 'x86' ] - ansible_pkg_mgr == 'apt' diff --git a/templates/landrush.j2 b/templates/landrush.j2 new file mode 100644 index 0000000..f3da357 --- /dev/null +++ b/templates/landrush.j2 @@ -0,0 +1 @@ +server=/vagrant/127.0.0.1#10053 diff --git a/templates/landrush.service.j2 b/templates/landrush.service.j2 new file mode 100644 index 0000000..42d7eb8 --- /dev/null +++ b/templates/landrush.service.j2 @@ -0,0 +1,7 @@ +[Unit] +Description=Vagrant Landrsuh DNS server +AssertPathIsDirectory=/home/{{ ansible_env.SUDO_USER }} + +[Service] +Type=forking +ExecStart=/usr/bin/vagrant landrush start diff --git a/workstation.yml b/workstation.yml index e4c9fc5..928c79a 100644 --- a/workstation.yml +++ b/workstation.yml @@ -16,7 +16,8 @@ state: restarted tasks: - - assert: + - name: Assertions + assert: that: - ansible_pkg_mgr == 'apt' @@ -73,7 +74,7 @@ - Restart Docker - name: Get Docker graph directory mountpoint - shell: df {{ docker_graph_directory }} + command: df {{ docker_graph_directory }} register: docker_graph_df changed_when: False -- GitLab