Migrate lf-ansible protobuf-install role 25/9025/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 23 Feb 2018 04:24:20 +0000 (23:24 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 23 Feb 2018 04:26:08 +0000 (23:26 -0500)
Change-Id: Id42adfc52fb12833bb906352e9892c6d77592b78
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
README.md
defaults/main.yml
molecule/default/molecule.yml
molecule/default/prepare.yml
tasks/main.yml

index 895e413..e00d6c5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -11,7 +11,8 @@ None.
 Role Variables
 --------------
 
-None.
+protoc_checksum: Checksum for Google protocol buffers compiler binary.
+protobuf_version: Version of Google protocol buffers to install.
 
 Dependencies
 ------------
@@ -25,7 +26,9 @@ None.
 
     - hosts: servers
       roles:
-         - { role: lfit.protobuf-install }
+         - role: lfit.protobuf-install
+           protobuf_version: 3.5.1
+           protoc_checksum: sha256:cd40f10bcdaff36429ec4652210f2bb8d6c7349e7b78f3a38ef42168401d7285
 
 License
 -------
index 1050956..8880f76 100644 (file)
@@ -1,2 +1,3 @@
 ---
-# defaults file for protobuf-install
+protobuf_version: 3.5.1
+protoc_checksum: sha256:cd40f10bcdaff36429ec4652210f2bb8d6c7349e7b78f3a38ef42168401d7285
index f5e3b11..02ec84c 100644 (file)
@@ -14,6 +14,17 @@ provisioner:
     name: ansible-lint
 scenario:
   name: default
+  test_sequence:
+    - lint
+    - destroy
+    - dependency
+    - syntax
+    - create
+    - prepare
+    - converge
+    - side_effect
+    - verify
+    - destroy
 verifier:
   name: testinfra
   lint:
index 5358b3b..42e1b8c 100644 (file)
@@ -2,4 +2,6 @@
 - name: Prepare
   hosts: all
   gather_facts: false
-  tasks: []
+  tasks:
+    - name: Install Unzip
+      package: name=unzip state=present
index 52c31f8..66ead18 100644 (file)
@@ -1,2 +1,39 @@
 ---
-# tasks file for protobuf-install
+- name: 'Download protoc binary {{protobuf_version}}'
+  get_url:
+    url: https://github.com/google/protobuf/releases/download/v{{protobuf_version}}/protoc-{{protobuf_version}}-linux-x86_64.zip
+    dest: /tmp/protobuf-{{protobuf_version}}-linux-x86_64.zip
+    checksum: '{{protoc_checksum}}'
+
+- name: Ensure protoc unpack directory exists
+  file:
+    path: /tmp/protoc
+    state: directory
+
+- name: 'Unarchive protoc {{protobuf_version}} binary'
+  unarchive:
+    src: /tmp/protobuf-{{protobuf_version}}-linux-x86_64.zip
+    dest: /tmp/protoc
+    remote_src: true
+
+- name: Copy Protoc binary to /usr/local/bin
+  copy:
+    src: /tmp/protoc/bin/protoc
+    dest: /usr/local/bin/protoc
+    mode: 0755
+    owner: root
+    remote_src: true
+  become: true
+
+- name: Copy Protoc includes to /usr/local/include
+  command: cp -r /tmp/protoc/include/google /usr/local/include
+  when: true
+  become: true
+
+- name: Set permissions on /usr/local/include/google
+  file:
+    path: /usr/local/include/google
+    mode: 0755
+    owner: root
+    recurse: true
+  become: true