-
Notifications
You must be signed in to change notification settings - Fork 1
/
CentOS7x_Install-dotNETCore-and-PowerShell-playbook.yml
105 lines (80 loc) · 3.62 KB
/
CentOS7x_Install-dotNETCore-and-PowerShell-playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
---
################################################################################
# description: Installs Microsoft .NET Core SDK and PowerShell on CentOS7x
# usage: ansible-playbook CentOS7x_Install-dotNETCore-and-PowerShell-playbook.yml --extra-vars 'HostOrGroup=YourServerOrGroupNameGoesHere'
# author: Ernest G. Wilson II <ErnestGWilsonII@gmail.com> (https://github.com/ernestgwilsonii)
# license: MIT
################################################################################
# Ansible Playbook options
# REF: http://docs.ansible.com/ansible/playbooks.html
#####################################################
- name: Install Microsoft .NET Core SDK and PowerShell on CentOS7x
hosts: "{{ HostOrGroup|default ('FATAL ERROR --> HostOrGroup NOT SET! You must specify either a Host or a Group name!') }}"
serial: "100%"
gather_facts: False
tasks:
# Install or configure repository used on the OS by yum
# REF: https://docs.ansible.com/ansible/yum_repository_module.html
##################################################################
# /etc/yum.repos.d/xamarin.repo
- name: Install repository Xamarin
yum_repository:
name: xamarin
description: Xamarin
file: xamarin
baseurl: http://download.mono-project.com/repo/centos/
enabled: yes
gpgcheck: no
gpgkey: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
# Install yum packages
# REF: http://docs.ansible.com/ansible/yum_module.html
######################################################
- name: Install the libicu package
yum:
name=libicu
state=latest
- name: Install the libunwind package
yum:
name=libunwind
state=latest
- name: Install Microsoft PowerShell for Linux via remote rpm
yum:
name: https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.15/powershell-6.0.0_alpha.15-1.el7.centos.x86_64.rpm
state: present
- name: Install the mono-complete package
yum:
name=mono-complete
state=latest
# get_url - Downloads files from HTTP, HTTPS, or FTP to node
# http://docs.ansible.com/ansible/get_url_module.html
#####################################################
- name: Download nuget.exe for .NET for use with mono
get_url:
url: https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
dest: /usr/local/bin/nuget.exe
mode: 0444
# file - Sets attributes of files and directories
# http://docs.ansible.com/ansible/file_module.html
##################################################
- name: Create directory /opt/dotnet if it does not exist
file:
path: /opt/dotnet
state: directory
mode: 0755
# unarchive - Unpacks an archive after (optionally) copying it from the local machine
# REF: http://docs.ansible.com/ansible/unarchive_module.html
############################################################
# wget https://go.microsoft.com/fwlink/?LinkID=835019
- name: Download and extract dotnet-dev-centos-x64.1.0.0-preview2-1-003177.tar.gz
unarchive:
src: http://download.microsoft.com/download/A/F/6/AF610E6A-1D2D-47D8-80B8-F178951A0C72/Binaries/dotnet-dev-centos-x64.1.0.0-preview2-1-003177.tar.gz
dest: /opt/dotnet
copy: no
# Use the file module to create a directory and symbolic links if they don't exist
# REF: http://docs.ansible.com/ansible/file_module.html
##################################################################################
- name: Create symbolic link if it does not exist - ln -s /opt/dotnet/dotnet /usr/local/bin/dotnet
file:
src: /opt/dotnet/dotnet
dest: /usr/local/bin/dotnet
state: link