Forráskód Böngészése

Added role to make sure that libsodium is installed

Till Klocke 9 éve
szülő
commit
a60b354d50

+ 38 - 0
roles/libsodium/README.md

@@ -0,0 +1,38 @@
+Role Name
+=========
+
+A brief description of the role goes here.
+
+Requirements
+------------
+
+Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
+
+Role Variables
+--------------
+
+A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
+
+Dependencies
+------------
+
+A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
+
+Example Playbook
+----------------
+
+Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
+
+    - hosts: servers
+      roles:
+         - { role: username.rolename, x: 42 }
+
+License
+-------
+
+BSD
+
+Author Information
+------------------
+
+An optional section for the role authors to include contact information, or a website (HTML is not allowed).

+ 7 - 0
roles/libsodium/defaults/main.yml

@@ -0,0 +1,7 @@
+---
+# defaults file for libsodium
+libsodium_build_from_source: true
+libsodum_version: 1.0.3
+libsodum_src_url: https://download.libsodium.org/libsodium/releases/libsodium-{{libsodum_version}}.tar.gz
+libsodium_build_dir: /usr/src/
+

+ 2 - 0
roles/libsodium/handlers/main.yml

@@ -0,0 +1,2 @@
+---
+# handlers file for libsodium

+ 17 - 0
roles/libsodium/meta/main.yml

@@ -0,0 +1,17 @@
+---
+galaxy_info:
+  author: Till Klocke
+  description: Installs libsodium
+  company: Freifunk Dortmund
+  license: MIT
+  min_ansible_version: 1.2
+  platforms:
+  - name: Ubuntu
+    versions:
+    - all
+  - name: Debian
+    versions:
+    - all
+  categories:
+  - system
+dependencies: []

+ 29 - 0
roles/libsodium/tasks/debian.yml

@@ -0,0 +1,29 @@
+- name: Check Debian version
+  set_fact: libsodium_build_from_source=true
+  when: ansible_lsb.major_release|int < 7
+
+- name: Add GPG key for Wheezy backports
+  when: ansible_distribution_release == 'wheezy'
+  apt_key: keyserver=pgpkeys.mit.edu id=8B48AD6246925553
+
+- name: Add Wheezy backports
+  when: ansible_distribution_release == 'wheezy'
+  apt_repository: repo='deb http://http.debian.net/debian wheezy-backports main' state=present update_cache=yes
+
+- name: Add GPG key for fastd Apt repo
+  when: ansible_distribution_release == 'wheezy'
+  apt_key: keyserver=pgpkeys.mit.edu id=16EF3F64CB201D9C
+
+- name: Add fastd Apt repo
+  when: ansible_distribution_release == 'wheezy'
+  apt_repository: repo='deb http://repo.universe-factory.net/debian/ sid main' state=present update_cache=yes
+
+- name: Install libsodium via Apt
+  when: libsodium_build_from_source != 'true'
+  apt: name={{item}} state=latest update_cache=yes
+  with_items:
+  - libsodium13
+  - libsodium-dev
+
+- include: source.yml
+  when: libsodium_build_from_source

+ 12 - 0
roles/libsodium/tasks/main.yml

@@ -0,0 +1,12 @@
+---
+# tasks file for libsodium
+
+- name: Check architecture
+  when: ansible_architecture != 'i386' and ansible_architecture != 'amd64'
+  set_fact: libsodium_build_from_source=true
+
+- include: ubuntu.yml
+  when: ansible_distribution == "Ubuntu"
+
+- include: debian.yml
+  when: ansible_distribution == "Debian"

+ 18 - 0
roles/libsodium/tasks/source.yml

@@ -0,0 +1,18 @@
+- name: Download libsodium
+  get_url: dest={{libsodium_build_dir}} url={{libsodum_src_url}}
+
+- name: Extract libsodium
+  unarchive: dest={{libsodium_build_dir}} copy=no src="/usr/src/libsodium-{{libsodum_version}}.tar.gz" creates="{{libsodium_build_dir}}/libsodium-{{libsodum_version}}"
+
+- name: Configure libsodium
+  register: libsodiumconfigured
+  command: ./configure chdir="{{libsodium_build_dir}}/libsodium-{{libsodum_version}}" creates="{{libsodium_build_dir}}/libsodium-{{libsodum_version}}/Makefile"
+
+- name: Compile libsodium
+  when: libsodiumconfigured|changed
+  register: libsodiumcompiled
+  shell: make && make check chdir="{{libsodium_build_dir}}/libsodium-{{libsodum_version}}"
+
+- name: Install libsodium
+  when: libsodiumcompiled|changed
+  command: make install chdir="{{libsodium_build_dir}}/libsodium-{{libsodum_version}}"

+ 13 - 0
roles/libsodium/tasks/ubuntu.yml

@@ -0,0 +1,13 @@
+- name: Check Ubuntu version
+  set_fact: libsodium_build_from_source=true
+  when: ansible_lsb.major_release|int < 15
+
+- include: source.yml
+  when: libsodium_build_from_source
+
+- name: Install libsodium via apt
+  when: libsodium_build_from_source != 'true'
+  apt: name={{item}} state=latest update_cache=yes
+  with_items:
+  - libsodium13
+  - libsodium-dev

+ 2 - 0
roles/libsodium/vars/main.yml

@@ -0,0 +1,2 @@
+---
+# vars file for libsodium