Smart Proxy: различия между версиями

Материал из ALT Linux Wiki
(Новая страница: «{{stub}} == Smart Proxy == Smart proxy - средство выполняющее вспомогательную для [https://theforeman.org/manuals/2.0/index…»)
 
 
(не показаны 22 промежуточные версии 4 участников)
Строка 3: Строка 3:
== Smart Proxy ==
== Smart Proxy ==


Smart proxy - средство выполняющее вспомогательную для [https://theforeman.org/manuals/2.0/index.html архитектуры Foreman] функцию, в организации процесса ввода в работу нового хоста. Для уменьшения задержек в эксплуатации, он может быть размешен на ПК вместе со службой Foreman или на близстоящем ПК. Smart proxy также часто называется как Foreman proxy.
Smart proxy средство выполняющее вспомогательную для [https://theforeman.org/manuals/2.0/index.html архитектуры Foreman] функцию, в организации процесса ввода в работу нового хоста. Для уменьшения задержек в эксплуатации, он может быть размешен на ПК вместе со службой Foreman или на близстоящем ПК. Smart proxy также часто называется как Foreman proxy.


=== Подготовка ===
=== Подготовка ===
Строка 11: Строка 11:
=== Установка ===
=== Установка ===


Чтобы установить средство, нужно от администратора поставить пакет smart-proxy, а всё требуемое вытянется по зависимостям.
Чтобы установить средство, нужно от администратора поставить пакет предоставляющий функционал прокси, для foreman 1.x это пакет {{pkg|smart-proxy-compat}}, для foreman 3.x это пакет: {{pkg|smart-proxy}}, а всё требуемое вытянется по зависимостям.  
 
Для foreman 1.x:
 
# apt-get install smart-proxy-compat
 
Для foreman 3.x:


  # apt-get install smart-proxy
  # apt-get install smart-proxy
=== Обновление ===
Если вы обновляете smart-proxy, то, в случае неудачного запуска службы из-за ошибочных зависимостей, после обновления пакеты необходимо удалять {{path|/var/lib/smart-proxy/Gemfile.lock}}, а после этого перезапускать службу снова.
Перед обновлением рекомендуется сделать страховую копию конфигурационных файлов из каталога {{path|/etc/smart-proxy/config}} с поддиректориями.


=== Настройка ===
=== Настройка ===
Пред запуском сервиса проверяем содержимое файлов ниже
''/etc/smart-proxy/config/settings.d/puppetca_http_api.yml''
---
#
# URL of the puppet master itself for API requests.
:puppet_url: <nowiki>https://sample.server.name:8140</nowiki>
#
# SSL certificates used to access the CA API.
:puppet_ssl_ca: /etc/puppet/ssl/certs/ca.pem
:puppet_ssl_cert: /etc/puppet/ssl/certs/sample.server.name.pem
:puppet_ssl_key: /etc/puppet/ssl/private_keys/sample.server.name.pem
''/etc/smart-proxy/config/settings.d/puppet_proxy_puppet_api.yml''
---
#
# URL of the puppet master itself for API requests.
:puppet_url: <nowiki>https://sample.server.name:8140</nowiki>
#
# SSL certificates used to access the CA API.
:puppet_ssl_ca: /etc/puppet/ssl/certs/ca.pem
:puppet_ssl_cert: /etc/puppet/ssl/certs/sample.server.name.pem
:puppet_ssl_key: /etc/puppet/ssl/private_keys/sample.server.name.pem
# Smart Proxy api timeout when Puppet's environment classes api is used and classes cache is disabled
:api_timeout: 30
''/etc/smart-proxy/config/settings.d/puppetca.yml''
---
#
# PuppetCA management
# Can be true, false, or http/https to enable just one of the protocols
#
:enabled: http
# valid providers:
#  - puppetca_hostname_whitelisting (verify CSRs based on a hostname whitelist)
#  - puppetca_token_whitelisting (verify CSRs based on a token whitelist)
:use_provider: puppetca_hostname_whitelisting
# Puppet version used
:puppet_version: 7.1.0
''/etc/smart-proxy/config/settings.d/puppet.yml''
---
# Can be true, false, or http/https to enable just one of the protocols
:enabled: http
# valid providers:
#  puppet_proxy_mcollective (uses mco puppet)
#  puppet_proxy_ssh        (run puppet over ssh)
#  puppet_proxy_salt        (uses salt puppet.run)
#  puppet_proxy_customrun  (calls a custom command with args)
#:use_provider: puppet_proxy_customrun
:puppet_version: 7.1.0
''/etc/smart-proxy/config/settings.d/puppetca_hostname_whitelisting.yml''
---
#
# Configuration of the PuppetCA hostname_whitelisting provider
#
:autosignfile: /etc/puppet/autosign.conf
''/etc/smart-proxy/config/settings.d/facts.yml''
---
# Can be true, false, or http/https to enable just one of the protocols
:enabled: true
Проверяем наличие файла {{path|/etc/puppet/autosign.conf}} и установленные на него разрешения
touch /etc/puppet/autosign.conf
chmod 664 /etc/puppet/autosign.conf
Для связи smart-proxy 3.x с foreman 3.x используйте в файле {{path|/etc/smart-proxy/config/settings.yml}} следующие параметры:
:trusted_hosts: [sample.server.name,localhost]
:foreman_url: <nowiki>https://sample.server.name:2345</nowiki>
:foreman_ssl_ca: /etc/foreman/ssl_key.pem
:foreman_ssl_cert: /etc/foreman/ssl_cert.pem
:foreman_ssl_key: /etc/foreman/ssl_key.pem
=== Запуск службы ===


Настройте системную службу smart-proxy на автозапуск (по желанию):
Настройте системную службу smart-proxy на автозапуск (по желанию):
Строка 25: Строка 117:
  # systemctl start smart-proxy
  # systemctl start smart-proxy


Отныне средство будет доступно в запросам http://localhost:8000 для Foreman.
Отныне средство будет доступно в запросам http://localhost:8000 для Foreman. Проверить можно например так:
 
# telnet localhost 8000
 
=== Настройка подключения Foreman и Smart-proxy ===
Настройка соединения Foreman и Smart-proxy производится через веб интерфейс Foreman.
Потребуется перейти в меню '''Инфраструктура -> Капсулы -> Create Smart Proxy'''
или по прямой ссылке
 
http://sample.server.name:2345/smart_proxies/new
 
Для foreman 3.x прямая ссылка:
 
https://sample.server.name:2345/smart_proxies/new
 
Адрес Smart-proxy ''http://sample.server.name:8000''
 
Запустите (через перезапуск) smart-proxy:
 
<pre>
# systemctl restart smart-proxy
</pre>
 
=== Добавление плагина ===
 
В зависимости от установленной версии smart-proxy выбираем каталог с примерами конфигурационных файлов.
 
Пример добавления плагина '''puppet_proxy_puppet_api.yml'''.
 
Из папки с примерами конфигурационных файлов smart-proxy {{path|/usr/lib/ruby/gems/2.5.0/gems/smart_proxy-1.24.3/config/settings.d}} копируем файл конфигурации в папку {{path|/etc/smart-proxy/config/settings.d/}} :
 
# cp /usr/lib/ruby/gems/2.5.0/gems/smart_proxy-1.24.3/config/settings.d/puppet_proxy_puppet_api.yml.example \
      /etc/smart-proxy/config/settings.d/puppet_proxy_puppet_api.yml
 
Изменяем в полученном файле ''puppet_proxy_puppet_api.yml'' необходимые параметры применительно к вашей системе:
<pre>
---
# URL of the puppet master itself for API requests.
:puppet_url: https://sample.server.test:8140
#
# SSL certificates used to access the puppet API
:puppet_ssl_ca: /etc/puppet/ssl/certs/ca.pem
:puppet_ssl_cert: /etc/puppet/ssl/certs/sample.server.test.pem
:puppet_ssl_key: /etc/puppet/ssl/private_keys/sample.server.test.pem
#
</pre>
Для применения конфигурации перезапускаем службу smart-proxy:
 
<source lang="bash">
# systemctl restart smart-proxy
</source>
==== Настройка плагина remote-execution ====
 
1. Для запуска функционала '''remote-execution''' проверяем наличие и содержимое файла настроек dynflow ниже:
 
''/etc/smart-proxy/config/settings.d/dynflow.yml''
<pre>
---
:enabled: http
:use_http: true
:database:
:core_url: http://sample.server.name:8008
 
# If true, external core will be used even if the core gem is available
# If false, the feature will be disabled if the core gem is unavailable
# If unset, the process will fallback to autodetection, using external core if the core gem is unavailable
:external_core: true
</pre>
 
2. И файла настроек remote-execution-ssh:
 
''/etc/smart-proxy/config/settings.d/remote_execution_ssh.yml''
<pre>
---
:enabled: true
:ssh_identity_key_file: /var/lib/smart-proxy/.ssh/id_rsa_foreman_proxy
:local_working_dir: /var/tmp
:remote_working_dir: /var/tmp
:kerberos_auth: false
 
# Whether to run remote execution jobs asynchronously
:async_ssh: false
</pre>
 
3. Настройка smart-proxy-dynflow-core:
 
{{Attention|Модуль smart-proxy-dynflow-core работает в связке с foreman версии 1.x только.
Для версии форемана от версии 2 и выше smart-proxy-dynflow-core не используется.}}
 
Редактируем файл ''/etc/smart_proxy_dynflow_core/settings.yml''
<pre>
---
# Path to dynflow database, leave blank for in-memory non-persistent database
:database:
 
# URL of the foreman, used for reporting back
:foreman_url: 'http://sample.server.name:2345'
 
# SSL settings for client authentication against Foreman
:foreman_ssl_ca: /etc/puppet/ssl/certs/ca.pem
:foreman_ssl_key: /etc/puppet/ssl/private_keys/sample.server.name.pem
:foreman_ssl_cert: /etc/puppet/ssl/certs/sample.server.name.pem
 
:console_auth: true
 
# Listen on address
:listen: 0.0.0.0
 
# Listen on port
:port: 8008
 
# SSL settings for running core as https service
:use_https: false
:ssl_ca_file: /etc/smart-proxy/ssl/certs/ca.pem
:ssl_private_key: /etc/puppet/ssl/private_keys/sample.server.name.pem
:ssl_certificate: /etc/puppet/ssl/certs/sample.server.name.pem
 
 
# File to log to, leave empty for logging to STDOUT
:log_file: /var/log/smart-proxy/smart_proxy_dynflow_core.log
</pre>
 
4. Создание ключей.
 
Создаем пару RSA ключей для пользователя '''_smartforeman'''
 
От имени пользователя '''root''' запускаем:
 
<pre>
# su - _smartforeman
$ mkdir /var/lib/smart-proxy/.ssh
$ ssh-keygen -t rsa -f .ssh/id_rsa_foreman_proxy
</pre>
 
Для удаленного запуска команд потребуется зарегистрировать созданный ключ в ''/root/.ssh/authorized_keys''
 
<pre>
# cat /var/lib/smart-proxy/.ssh/id_rsa_foreman_proxy.pub >> /root/.ssh/authorized_keys
</pre>
 
5. Запуск служб.
 
Разрешаем необходимые сервисы и запускаем их:
 
<pre>
# systemctl enable foreman-jobs
# systemctl enable smart-proxy-dynflow-core
# systemctl restart foreman-jobs
# systemctl restart smart-proxy-dynflow-core
</pre>
 
Функционал будет доступен после перезапуска сервиса '''smart-proxy''' и обновления активных функций  капсул
<pre>
# systemctl enable smart-proxy
</pre>
 
==== Настройка плагина ansible ====
 
Разрешаем ansible в smart-proxy
''/etc/smart-proxy/config/settings.d/ansible.yml''
<pre>
---
:enabled: true
:ansible_dir: /usr/lib/foreman
:working_dir: /tmp
</pre>
Проверяем настройки пакета '''ansible'''
 
Для получения списка хостов '''ansible''' обращается к файлу ''/etc/ansible/hosts''
 
Настроим его
<pre>
agents:
  hosts:
    host.server.name:
    ansible_user: root
</pre>
 
Для использования подключения ansible без запроса пароля, требуется сгенерировать ключ эффективного пользователя(root):
<source lang="bash">
ssh-keygen -f ~/.ssh/id_rsa -N ''
</source>
После создания ключа передать его на нужные узлы:
<source lang="bash">
ssh-copy-id -i ~/.ssh/id_rsa root@host.server.name
</source>
Проверить работу '''аnsible''', выполнив пинг на группу хостов agents:
<source lang="bash">
ansible -m ping agents
</source>
 
==== Настройка плагина TFTP ====
 
Для задействования функции работы с '''TFTP''' сервером редактируем содержимое файла
 
''/etc/smart-proxy/config/settings.d/tftp.yml''
<pre>
---
# Can be true, false, or http/https to enable just one of the protocols
:enabled: true
 
:tftproot: /var/lib/tftpboot
# Defines the TFTP Servername to use, overrides the name in the subnet declaration
:tftp_servername: sample.server.name
 
# Defines the default read timeout in seconds needed to download tftp artifacts
# like initrd and vmlinuz. Default value 60 seconds
#:tftp_read_timeout: 60
 
# Defines the default connection timeout in seconds needed to download tftp artifacts
# like initrd and vmlinuz. Default value 10 seconds
#:tftp_connect_timeout: 10
 
# Defines the default dns timeout in seconds needed to download tftp artifacts
# like initrd and vmlinuz. Default value 10 seconds
#:tftp_dns_timeout: 10
</pre>
 
==== Настройка плагина DHCP ====
 
Для подключения возможности использовать '''DHCP''' необходимо создать/редактировать содержимое файлов
''/etc/smart-proxy/config/settings.d/dhcp_isc.yml''
<pre>
---
#
# Configuration file for ISC dhcp provider
#
 
:config: /etc/dhcp/dhcpd.conf
:leases: /var/lib/dhcp/dhcpd/state/dhcpd.leases
 
# Specifies TSIG key name and secret
 
#:key_name: secret_key_name
#:key_secret: secret_key
 
:omapi_port: 7911
</pre>
 
Укажите параметры вашего '''DHCP''' в файле ''/etc/smart-proxy/config/settings.d/dhcp.yml''
<pre>
---
# Can be true, false, or http/https to enable just one of the protocols
:enabled: true
 
# valid providers:
#  - dhcp_isc (ISC dhcp server)
#  - dhcp_native_ms (Microsoft native implementation)
#  - dhcp_libvirt
:use_provider: dhcp_isc
:server: 10.10.10.2
# subnets restricts the subnets queried to a subset, to reduce the query time.
#:subnets: [192.168.205.0/255.255.255.128, 192.168.205.128/255.255.255.128]
:subnets: [10.10.10.128/255.255.255.128 ]
 
# Perform ICMP and TCP ping when searching free IPs from the pool. This makes
# sure that active IP address is not suggested as free, however in locked down
# network environments this can cause no free IPs. Enabled by default
:ping_free_ip: true
</pre>
 
Если '''DHCP''' сервер располагается на одном сервере с сервером '''smart-proxy''', добавляем пользователя '''_smartforeman''' в группы named и dhcp
<source lang="bash">
usermod -G dhcp -a _smartforeman
usermod -G named -a _smartforeman
</source>
 
Чтобы пользователь '''_smartproxy''' смог читать файл конфигурации '''DHCP''' сервера установим атрибуты на ''/etc/dhcp/dhcpd.conf''
<source lang="bash">
chmod 644 /etc/dhcp/dhcpd.conf
</source>
 
=== Проверка версий ===
 
Проверяем версию smart-proxy и подключенных плагинов, используя API запрос:
 
$ curl -k -H "Accept: application/json" http://localhost:8000/version


=== Переустановка или обновление ===
=== Переустановка или обновление ===
Строка 31: Строка 399:
Чтобы переустановить или обновить средство нужно выполнить 2 команды подряд:
Чтобы переустановить или обновить средство нужно выполнить 2 команды подряд:


  # apt-get install smart-proxy
  # apt-get install smart-proxy-compat
  # apt-get dist-upgrade
  # apt-get dist-upgrade


=== Полное удаление ===
=== Полное удаление ===


  # apt-get remove smart-proxy
  # apt-get remove smart-proxy-compat


[[Category: foreman]]
[[Category: foreman]]
[[Категория:Прокси]]
[[Категория:Управление автоматизацией]]
[[Категория:Управление автоматизацией]]
{{Category navigation|title=Управление автоматизацией|category=Управление автоматизацией|sortkey={{SUBPAGENAME}}}}
{{Category navigation|title=Управление автоматизацией|category=Управление автоматизацией|sortkey={{SUBPAGENAME}}}}
{{Category navigation|title=HOWTO|category=HOWTO|sortkey={{SUBPAGENAME}}}}

Текущая версия от 15:16, 1 августа 2023

Stub.png
Данная страница находится в разработке.
Эта страница ещё не закончена. Информация, представленная здесь, может оказаться неполной или неверной.


Smart Proxy

Smart proxy — средство выполняющее вспомогательную для архитектуры Foreman функцию, в организации процесса ввода в работу нового хоста. Для уменьшения задержек в эксплуатации, он может быть размешен на ПК вместе со службой Foreman или на близстоящем ПК. Smart proxy также часто называется как Foreman proxy.

Подготовка

Перед установкой убедитесь, что Foreman установлен и инициализирован. Это важно.

Установка

Чтобы установить средство, нужно от администратора поставить пакет предоставляющий функционал прокси, для foreman 1.x это пакет smart-proxy-compat, для foreman 3.x это пакет: smart-proxy, а всё требуемое вытянется по зависимостям.

Для foreman 1.x:

# apt-get install smart-proxy-compat

Для foreman 3.x:

# apt-get install smart-proxy

Обновление

Если вы обновляете smart-proxy, то, в случае неудачного запуска службы из-за ошибочных зависимостей, после обновления пакеты необходимо удалять /var/lib/smart-proxy/Gemfile.lock, а после этого перезапускать службу снова.

Перед обновлением рекомендуется сделать страховую копию конфигурационных файлов из каталога /etc/smart-proxy/config с поддиректориями.

Настройка

Пред запуском сервиса проверяем содержимое файлов ниже

/etc/smart-proxy/config/settings.d/puppetca_http_api.yml

---
#
# URL of the puppet master itself for API requests.
:puppet_url: https://sample.server.name:8140
#
# SSL certificates used to access the CA API.
:puppet_ssl_ca: /etc/puppet/ssl/certs/ca.pem
:puppet_ssl_cert: /etc/puppet/ssl/certs/sample.server.name.pem
:puppet_ssl_key: /etc/puppet/ssl/private_keys/sample.server.name.pem

/etc/smart-proxy/config/settings.d/puppet_proxy_puppet_api.yml

---
#
# URL of the puppet master itself for API requests.
:puppet_url: https://sample.server.name:8140
#
# SSL certificates used to access the CA API.
:puppet_ssl_ca: /etc/puppet/ssl/certs/ca.pem
:puppet_ssl_cert: /etc/puppet/ssl/certs/sample.server.name.pem
:puppet_ssl_key: /etc/puppet/ssl/private_keys/sample.server.name.pem
# Smart Proxy api timeout when Puppet's environment classes api is used and classes cache is disabled
:api_timeout: 30

/etc/smart-proxy/config/settings.d/puppetca.yml

---
#
# PuppetCA management
# Can be true, false, or http/https to enable just one of the protocols
#
:enabled: http
# valid providers:
#   - puppetca_hostname_whitelisting (verify CSRs based on a hostname whitelist)
#   - puppetca_token_whitelisting (verify CSRs based on a token whitelist)
:use_provider: puppetca_hostname_whitelisting
# Puppet version used
:puppet_version: 7.1.0

/etc/smart-proxy/config/settings.d/puppet.yml

---
# Can be true, false, or http/https to enable just one of the protocols
:enabled: http
# valid providers:
#   puppet_proxy_mcollective (uses mco puppet)
#   puppet_proxy_ssh         (run puppet over ssh)
#   puppet_proxy_salt        (uses salt puppet.run)
#   puppet_proxy_customrun   (calls a custom command with args)
#:use_provider: puppet_proxy_customrun
:puppet_version: 7.1.0

/etc/smart-proxy/config/settings.d/puppetca_hostname_whitelisting.yml

---
#
# Configuration of the PuppetCA hostname_whitelisting provider
#
:autosignfile: /etc/puppet/autosign.conf

/etc/smart-proxy/config/settings.d/facts.yml

---
# Can be true, false, or http/https to enable just one of the protocols
:enabled: true

Проверяем наличие файла /etc/puppet/autosign.conf и установленные на него разрешения

touch /etc/puppet/autosign.conf
chmod 664 /etc/puppet/autosign.conf


Для связи smart-proxy 3.x с foreman 3.x используйте в файле /etc/smart-proxy/config/settings.yml следующие параметры:

:trusted_hosts: [sample.server.name,localhost]
:foreman_url: https://sample.server.name:2345
:foreman_ssl_ca: /etc/foreman/ssl_key.pem
:foreman_ssl_cert: /etc/foreman/ssl_cert.pem
:foreman_ssl_key: /etc/foreman/ssl_key.pem

Запуск службы

Настройте системную службу smart-proxy на автозапуск (по желанию):

# systemctl enable smart-proxy

а дальше запустите её:

# systemctl start smart-proxy

Отныне средство будет доступно в запросам http://localhost:8000 для Foreman. Проверить можно например так:

# telnet localhost 8000

Настройка подключения Foreman и Smart-proxy

Настройка соединения Foreman и Smart-proxy производится через веб интерфейс Foreman. Потребуется перейти в меню Инфраструктура -> Капсулы -> Create Smart Proxy или по прямой ссылке

http://sample.server.name:2345/smart_proxies/new

Для foreman 3.x прямая ссылка:

https://sample.server.name:2345/smart_proxies/new

Адрес Smart-proxy http://sample.server.name:8000

Запустите (через перезапуск) smart-proxy:

# systemctl restart smart-proxy

Добавление плагина

В зависимости от установленной версии smart-proxy выбираем каталог с примерами конфигурационных файлов.

Пример добавления плагина puppet_proxy_puppet_api.yml.

Из папки с примерами конфигурационных файлов smart-proxy /usr/lib/ruby/gems/2.5.0/gems/smart_proxy-1.24.3/config/settings.d копируем файл конфигурации в папку /etc/smart-proxy/config/settings.d/ :

# cp /usr/lib/ruby/gems/2.5.0/gems/smart_proxy-1.24.3/config/settings.d/puppet_proxy_puppet_api.yml.example \
     /etc/smart-proxy/config/settings.d/puppet_proxy_puppet_api.yml

Изменяем в полученном файле puppet_proxy_puppet_api.yml необходимые параметры применительно к вашей системе:

---
# URL of the puppet master itself for API requests.
:puppet_url: https://sample.server.test:8140
#
# SSL certificates used to access the puppet API
:puppet_ssl_ca: /etc/puppet/ssl/certs/ca.pem
:puppet_ssl_cert: /etc/puppet/ssl/certs/sample.server.test.pem
:puppet_ssl_key: /etc/puppet/ssl/private_keys/sample.server.test.pem
#

Для применения конфигурации перезапускаем службу smart-proxy:

 # systemctl restart smart-proxy

Настройка плагина remote-execution

1. Для запуска функционала remote-execution проверяем наличие и содержимое файла настроек dynflow ниже:

/etc/smart-proxy/config/settings.d/dynflow.yml

---
:enabled: http
:use_http: true
:database:
:core_url: http://sample.server.name:8008

# If true, external core will be used even if the core gem is available
# If false, the feature will be disabled if the core gem is unavailable
# If unset, the process will fallback to autodetection, using external core if the core gem is unavailable
:external_core: true

2. И файла настроек remote-execution-ssh:

/etc/smart-proxy/config/settings.d/remote_execution_ssh.yml

---
:enabled: true
:ssh_identity_key_file: /var/lib/smart-proxy/.ssh/id_rsa_foreman_proxy
:local_working_dir: /var/tmp
:remote_working_dir: /var/tmp
:kerberos_auth: false

# Whether to run remote execution jobs asynchronously
:async_ssh: false

3. Настройка smart-proxy-dynflow-core:

Внимание! Модуль smart-proxy-dynflow-core работает в связке с foreman версии 1.x только. Для версии форемана от версии 2 и выше smart-proxy-dynflow-core не используется.


Редактируем файл /etc/smart_proxy_dynflow_core/settings.yml

---
# Path to dynflow database, leave blank for in-memory non-persistent database
:database:

# URL of the foreman, used for reporting back
:foreman_url: 'http://sample.server.name:2345'

# SSL settings for client authentication against Foreman
:foreman_ssl_ca: /etc/puppet/ssl/certs/ca.pem
:foreman_ssl_key: /etc/puppet/ssl/private_keys/sample.server.name.pem
:foreman_ssl_cert: /etc/puppet/ssl/certs/sample.server.name.pem

:console_auth: true

# Listen on address
:listen: 0.0.0.0

# Listen on port
:port: 8008

# SSL settings for running core as https service
:use_https: false 
:ssl_ca_file: /etc/smart-proxy/ssl/certs/ca.pem
:ssl_private_key: /etc/puppet/ssl/private_keys/sample.server.name.pem
:ssl_certificate: /etc/puppet/ssl/certs/sample.server.name.pem


# File to log to, leave empty for logging to STDOUT
:log_file: /var/log/smart-proxy/smart_proxy_dynflow_core.log

4. Создание ключей.

Создаем пару RSA ключей для пользователя _smartforeman

От имени пользователя root запускаем:

# su - _smartforeman
$ mkdir /var/lib/smart-proxy/.ssh
$ ssh-keygen -t rsa -f .ssh/id_rsa_foreman_proxy

Для удаленного запуска команд потребуется зарегистрировать созданный ключ в /root/.ssh/authorized_keys

# cat /var/lib/smart-proxy/.ssh/id_rsa_foreman_proxy.pub >> /root/.ssh/authorized_keys 

5. Запуск служб.

Разрешаем необходимые сервисы и запускаем их:

# systemctl enable foreman-jobs
# systemctl enable smart-proxy-dynflow-core
# systemctl restart foreman-jobs
# systemctl restart smart-proxy-dynflow-core

Функционал будет доступен после перезапуска сервиса smart-proxy и обновления активных функций капсул

# systemctl enable smart-proxy

Настройка плагина ansible

Разрешаем ansible в smart-proxy /etc/smart-proxy/config/settings.d/ansible.yml

---
:enabled: true
:ansible_dir: /usr/lib/foreman
:working_dir: /tmp

Проверяем настройки пакета ansible

Для получения списка хостов ansible обращается к файлу /etc/ansible/hosts

Настроим его

agents:
   hosts:
     host.server.name:
     ansible_user: root

Для использования подключения ansible без запроса пароля, требуется сгенерировать ключ эффективного пользователя(root):

ssh-keygen -f ~/.ssh/id_rsa -N ''

После создания ключа передать его на нужные узлы:

ssh-copy-id -i ~/.ssh/id_rsa root@host.server.name

Проверить работу аnsible, выполнив пинг на группу хостов agents:

ansible -m ping agents

Настройка плагина TFTP

Для задействования функции работы с TFTP сервером редактируем содержимое файла

/etc/smart-proxy/config/settings.d/tftp.yml

---
# Can be true, false, or http/https to enable just one of the protocols
:enabled: true

:tftproot: /var/lib/tftpboot
# Defines the TFTP Servername to use, overrides the name in the subnet declaration
:tftp_servername: sample.server.name

# Defines the default read timeout in seconds needed to download tftp artifacts
# like initrd and vmlinuz. Default value 60 seconds
#:tftp_read_timeout: 60

# Defines the default connection timeout in seconds needed to download tftp artifacts
# like initrd and vmlinuz. Default value 10 seconds
#:tftp_connect_timeout: 10

# Defines the default dns timeout in seconds needed to download tftp artifacts
# like initrd and vmlinuz. Default value 10 seconds
#:tftp_dns_timeout: 10

Настройка плагина DHCP

Для подключения возможности использовать DHCP необходимо создать/редактировать содержимое файлов /etc/smart-proxy/config/settings.d/dhcp_isc.yml

---
#
# Configuration file for ISC dhcp provider
#

:config: /etc/dhcp/dhcpd.conf
:leases: /var/lib/dhcp/dhcpd/state/dhcpd.leases

# Specifies TSIG key name and secret

#:key_name: secret_key_name
#:key_secret: secret_key

:omapi_port: 7911

Укажите параметры вашего DHCP в файле /etc/smart-proxy/config/settings.d/dhcp.yml

---
# Can be true, false, or http/https to enable just one of the protocols
:enabled: true

# valid providers:
#   - dhcp_isc (ISC dhcp server)
#   - dhcp_native_ms (Microsoft native implementation)
#   - dhcp_libvirt
:use_provider: dhcp_isc
:server: 10.10.10.2
# subnets restricts the subnets queried to a subset, to reduce the query time.
#:subnets: [192.168.205.0/255.255.255.128, 192.168.205.128/255.255.255.128]
:subnets: [10.10.10.128/255.255.255.128 ]

# Perform ICMP and TCP ping when searching free IPs from the pool. This makes
# sure that active IP address is not suggested as free, however in locked down
# network environments this can cause no free IPs. Enabled by default
:ping_free_ip: true

Если DHCP сервер располагается на одном сервере с сервером smart-proxy, добавляем пользователя _smartforeman в группы named и dhcp

usermod -G dhcp -a _smartforeman
usermod -G named -a _smartforeman

Чтобы пользователь _smartproxy смог читать файл конфигурации DHCP сервера установим атрибуты на /etc/dhcp/dhcpd.conf

chmod 644 /etc/dhcp/dhcpd.conf

Проверка версий

Проверяем версию smart-proxy и подключенных плагинов, используя API запрос:

$ curl -k -H "Accept: application/json" http://localhost:8000/version

Переустановка или обновление

Чтобы переустановить или обновить средство нужно выполнить 2 команды подряд:

# apt-get install smart-proxy-compat
# apt-get dist-upgrade

Полное удаление

# apt-get remove smart-proxy-compat