所以,我有流浪文件:
# -*- mode: ruby -*-
# vi: set ft=ruby :
IP = "192.168.33.55"
VM_NAME = "jenkins"
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "geerlingguy/ubuntu1604" #target OS: Ubuntu 16.04
config.ssh.insert_key = false
config.vm.synced_folder ".", "/vagrant", disabled: true
config.ssh.forward_agent = true
config.vm.provider :virtualbox do |v|
v.name = VM_NAME
v.memory = 1024
v.cpus = 2
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--ioapic", "on"]
end
config.vm.hostname = VM_NAME
config.vm.network :private_network, ip: IP
config.vm.network "forwarded_port", guest: 80, host: 8080
# Set the name of the VM. See: http://stackoverflow.com/a/17864388/100134
config.vm.define :jenkins do |jenkins|
end
# Ansible provisioner.
config.vm.provision "ansible" do |ansible|
ansible.playbook = "jenkins/playbook.yml"
ansible.inventory_path = "jenkins/inventory"
ansible.sudo = true
end
end
和詹金斯安装剧本:
---
- name: Install Jenkins
hosts: jenkins
gather_facts: yes
vars_files:
- vars/main.yml
pre_tasks:
- name: Install Python for Ansible
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
# changed_when: False
# - setup: # aka gather_facts
become: yes
become_user: root
remote_user: vagrant
vars:
- update_apt_cache: yes
roles:
- base
- geerlingguy.jenkins
- android-sdk
android-sdk
角色包含文件main.yml,任务如下:
---
- name: Download Android SDK
action: get_url url=https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip dest=/tmp/android.tgz
- name: Make opt dir for user
action: file path=/opt/adt/ state=directory mode=0777
- name: Unpack Android SDK
action: unarchive copy=no src=/tmp/android.tgz dest=/opt/adt/ creates=/opt/adt//android-sdk-linux
- name: Chown files
action: file path=/opt/adt/android-sdk-linux recurse=yes state=directory
- name: Install Android SDK
action: shell creates=/opt/adt/android-sdk-linux/tools echo y | /opt/adt/android-sdk-linux/tools/android
- name: Configure Android SDK paths
action: lineinfile dest=/home/vagrant/.bashrc line="{{ item }}"
with_items:
- 'export ANDROID_HOME=/opt/adt/android-sdk-linux'
- 'export ANDROID_TOOLS=$ANDROID_HOME/tools/'
- 'export ANDROID_PLATFORM_TOOLS=$ANDROID_HOME/platform-tools/'
- 'export PATH=$PATH:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS'
vagrant up
< TASK [android-sdk : Download Android SDK] >
changed: [jenkins]
< TASK [android-sdk : Make opt dir for user] >
changed: [jenkins]
< TASK [android-sdk : Unpack Android SDK] >
changed: [jenkins]
< TASK [android-sdk : Chown files] >
changed: [jenkins]
< TASK [android-sdk : Install Android SDK] >
fatal: [jenkins]: FAILED! => {"changed": true, "cmd": "echo y |
/opt/adt/android-sdk-linux/tools/android", "delta":
"0:00:00.004105", "end": "2017-07-28 17:17:24.446018", "failed":
true, "rc": 127, "start": "2017-07-28 17:17:24.441913", "stderr":
"/bin/sh: 1: /opt/adt/android-sdk-linux/tools/android: not found",
"stderr_lines": ["/bin/sh: 1: /opt/adt/android-sdk-linux/tools/android: not found"],
"stdout": "", "stdout_lines": []}
jenkins : ok=41 changed=2 unreachable=0
failed=1
Ansible failed to complete successfully. Any error output should
be visible above. Please fix these errors and try again.
两个主要问题是,unarchive
任务不能创建/opt/adt/android-sdk-linux
目录,并且我认为安装SDK的命令不正确。
顺便说明,您不需要对每个任务使用action
模块。您可以简单地用操作中的模块替换它。
- name: Make opt dir for user
action: file path=/opt/adt/ state=directory mode=0777
会变成
- name: Make opt dir for user
file:
path: /opt/adt/
state: directory
mode: 0777
- name: Create Android SDK directory
file:
path: /opt/adt/android-sdk-linux
state: directory
- name: Unpack Android SDK
unarchive:
copy: no
src: /tmp/android.tgz
dest: /opt/adt/android-sdk-linux
creates: /opt/adt/android-sdk-linux/tools
- name: Install Android SDK
shell: yes | ./android update sdk
args:
chdir: /opt/adt/android-sdk-linux/tools
本文向大家介绍ansible 在MacOS上安装Ansible,包括了ansible 在MacOS上安装Ansible的使用技巧和注意事项,需要的朋友参考一下 示例 有两种主要方法可以使用Homebrew或Pip软件包管理器在OS X上安装Ansible。 如果您有自制软件,则可以使用以下命令安装最新的Ansible: 要安装Ansible 1.9.X分支,请使用以下命令: 要安装Ansible
如果你只是想体验下ansible tower,那么它的安装方法极其简单,只需要运行一个bash脚本就可以。当然在这个bash中,是调用ansible来ansible tower才能做到这么简单的。 all-in-one版就是所有的ansible tower的组件,服务器,数据库都安装在一台机器上,只需要遵循以下步骤就可以了: 准备一台RHEL7的裸机器,注册redhat,或者CentOS7。 下载
这里以RedHat系Linux为例,其他系统请参考ansible的官网 管理员的电脑上: 安裝Ansible软件 $ # Redhat/CentOS Linux上,Ansible目前放在的epel源中 $ # Fedora默认源中包含ansible,直接安装包既可 $ sudo yum install epel-release $ sudo yum install ansible -y 配置Ans
我有一些Ansible剧本,我想和一些Windows主机对抗。我遵循了各种Ansible指南来设置WinRM,它们工作得很好,但默认设置非常不安全,我想要更适合生产的东西。然而,关于如何做到这一点的说明却少得令人难以置信。到目前为止,我已经做了以下工作: 在我的Windows盒子上: 使用提供的配置RemotingForAnsible.ps1脚本启用WinRM 将目标机器配置为在HTTPS/598
本文向大家介绍Centos下安装Ansible的示例代码,包括了Centos下安装Ansible的示例代码的使用技巧和注意事项,需要的朋友参考一下 ansible ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、cfengine、chef、func、fabric)的优点,实现了批量系统配置、批量程序部署、批量运行命令等功能。 ansible是基于模块
AndroidSDK Android SDK development environment Docker image Goals It contains the complete Android SDK enviroment, is able to perform all regular Android jobs. Solves the problem of "It works on my ma